Created
June 28, 2010 16:10
-
-
Save hubgit/456028 to your computer and use it in GitHub Desktop.
Check if a file exists, with case-insensitive file name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function file_exists_ci($file) { | |
if (file_exists($file)) | |
return $file; | |
$lowerfile = strtolower($file); | |
foreach (glob(dirname($file) . '/*') as $file) | |
if (strtolower($file) == $lowerfile) | |
return $file; | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment