PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Is there a way to have the file_exists() function do a case insensitive search? I have alot of people who's links (either favorites or search engines) have all lowercased links. My site uses a simple include script like index.php?ServicePage=ClutchNew . If someone for say did a ServicePage=clutchnew I'd like the page to still display. Besides building an array with over a thousand values, one for each page; is there a way to do a case insensitive search? maybe something like:
If you work with unix I don't think this is possible ... since Unix just is case sensitive.
But you could give your pages numbers or name them all lowercase or you could realize a file_exists function of your own
but this:
if (strtolower(file_exists(strtolower("$ServicePage.php")))){
$IncludeFile = "$ServicePage";
}
won't work. Because what you do is you search for a lowercase filename which probably does not exist and change the return-value of the file_exists() function to lowercase.
you also could generate a mapping file which has as first parameter the lowercase filename like the one you get from the users an second parameter the filename for the file on the system (eg "lowercasefilename@FileNameInReal"). depending on names convention etc pp you could do an awk script that automatically generates the list every hour or so.