I understand that using PHP’s basename() function you can strip a known file extension from a path like so,
basename('path/to/file.php','.php')
but what if you didn’t know what extension the file had or the length of that extension? How would I accomplish this?
Thanks in advance!
pathinfo()was already mentioned here, but I’d like to add that from PHP 5.2 it also has a simple way to access the filename WITHOUT the extension.The value of
$filenamewill befile.