PHP Classes

File: PHP_toolbucket/SoftMoon/file_path_exists.php

Recommend this page to a friend!
  Packages of Joseph   Rainbow Maker   PHP_toolbucket/SoftMoon/file_path_exists.php   Download  
File: PHP_toolbucket/SoftMoon/file_path_exists.php
Role: Auxiliary script
Content type: text/plain
Description: PHP utility function
Class: Rainbow Maker
Create transparent gradient images
Author: By
Last change:
Date: 14 years ago
Size: 560 bytes
 

 

Contents

Class file image Download
<?php

if (!defined('DIR_SEP'))  {
    if (stripos(php_uname('s'), 'Win')===FALSE)    // Mac OS/LINUX/UNIX directory separator
        define('DIR_SEP', "/");
    else    // MS Windows directory separator
        define('DIR_SEP', "\\");  }
        

function file_path_exists($fn)  {
    if (file_exists($fn))  return $fn;
    $paths=explode(PATH_SEPARATOR, get_include_path());
    foreach ($paths as &$p)  {if (substr($p, strlen($p)-1)!==DIR_SEP)  $p.=DIR_SEP;}
    $i=0;  $m=count($paths);
    do {if (file_exists($paths[$i].$fn))  return $paths[$i].$fn;}
    while (++$i<$m);
    return FALSE;  }

?>