Re: substr question...

From: Date: Sat, 28 Jul 2001 00:24:35 +0000
Subject: Re: substr question...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60019@lists.php.net to get a copy of this message
You wrote: > I am trying to receive file names but can't quite figure out the proper > substr to do it: > > jeff.dat > jeffrey.dat > chris.dat > tom.dat > > I want to receive the name to the left of the .dat > > Jeff $file = array("jeff.dat", "jeffrey.dat", "chris.dat", "tom.dat"); for($i=0; $i<count($file); $i++){ eregi("^(.*)\.dat$", $file[$i], $ary); $filename = $ary[1]; // Do something with $filename print "$filename<br>\n"; } HTH! :) -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/

« previous php.general (#60019) next »