Re: Array_search

From: Date: Tue, 27 Apr 2004 07:57:04 +0000
Subject: Re: Array_search
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184735@lists.php.net to get a copy of this message
Hi, Tuesday, April 27, 2004, 4:46:17 PM, you wrote: IB> Hi, IB> This is what I have done so far: IB> <?php IB> $dfile=file($cfg); IB> $testingstring = "#this,line,is,for,ian"; IB> $testing=array_search($testingstring, $dfile); IB> print_r ($testing); ?>> IB> This is the exact line from the $cfg file that I am searching for: IB> #this,line,is,for,ian IB> It doesnt work, it doesnt return anything. Anyone know why? I cant figure it IB> out. IB> Thanks alot. IB> Ian You could try preg_grep() <?php $dfile=file($cfg); $testingstring = "#this,line,is,for,ian"; $testing=preg_grep('/'.$testingstring.'\s*/', $dfile); print_r ($testing); ?> That should take care of any end of line stuff -- regards, Tom

« previous php.general (#184735) next »