Is it possible to find the name of a file minus the suffix?
I.e. (using qbasic/psion style commands)
file$ = "index.php"; $filename = $left(file$,len($file - 4);
What are the quivalent PHP commands?
Thanks
Rob
actually, i just realised you can use the explode function
$filename = substr($file, 0, -4); will give you the name only but not the extension. but this is only good for file names with extensions only 3 character long (.xxx).
for more flexible handling you can use reg-ex.
yes, you can do explode(), but that will explode all the '.' you have in your string. what if you have a filename with name.file.doc ?? then you end up with an array with 3 elements.
anyway, it will work.
thanks for your help, i'll use the explode method because all my files are file.doc rather than file.doc.doc as i make the whole site myself.
thanks