Re: reading pre-extension file

From: Date: Thu, 12 Dec 2002 15:13:43 +0000
Subject: Re: reading pre-extension file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128016@lists.php.net to get a copy of this message
Does it HAVE to be done with a regexp? <? $file = "foo.bah.cat.dog.php"; $pre = count($segments = explode('.',$file)) - 2; echo $segments[$pre]; ?> You'd have to do a test to see which is quicker (regexp or this method), but I *think* this would be quicker. Better still, it's "future proof" by working for a.file.with.more.than.two.dots :) Cheers, Justin on 12/12/02 4:40 AM, Luca (dinicola@goinfoteam.it) wrote: > How to read "pre-extension" of file with regular expression? > Example: name.preextension.doc > > I need to read "preextension" > > Tanks! > > Justin French -------------------- http://Indent.com.au Web Development & Graphic Design --------------------

« previous php.general (#128016) next »