|
Posted by Toby A Inkster on 03/05/07 11:25
Geoff Berrow wrote:
> $file='foo.gif';
> echo substr($file, 0, strpos($file,".")); // echoes 'foo'
Assuming there is only one dot in the file name. (Which is often not a
safe assumption[1], but what the hell...)
list($name, $ext)=explode('.', $filename);
Much easier than faffing around with substr and strpos and all that junk.
____
1. http://message-id.net/ogt3b4-31g.ln1%40ophelia.g5n.co.uk
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
Navigation:
[Reply to this message]
|