Skip to content

Instantly share code, notes, and snippets.

@hubgit
Created June 28, 2010 16:10
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hubgit/456028 to your computer and use it in GitHub Desktop.
Save hubgit/456028 to your computer and use it in GitHub Desktop.
Check if a file exists, with case-insensitive file name.
<?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