Login   Register  
PHP Classes
elePHPant
Icontem

File: PHP_toolbucket/SoftMoon/file_path_exists.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes 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: 2012-02-12 21:41
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_SEPARATORget_include_path());
    foreach (
$paths as &$p)  {if (substr($pstrlen($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;  }

?>