Re: Array_search
| From: | De Greef S�bastien | Date: | Tue, 27 Apr 2004 08:20:34 +0000 |
| Subject: | Re: Array_search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184737@lists.php.net to get a copy of this message | ||
you should convert the string in an array before searching it
$array = explode("," , $testingstring);
will change it in an array.
take care of the # sign before doing it.
preg function is good if you don't need it to be an array.
strpos is quitte the same i think
excuse me for my bro|<en english
Regards
"Ian Barnes" <ian@cerebellum.za.net> a écrit dans le message news:
DGEOIPPIAJBPINGMKMGKIEFLFFAA.ian@cerebellum.za.net...
> Hi,
>
> This is what I have done so far:
> <?php
> $dfile=file($cfg);
> $testingstring = "#this,line,is,for,ian";
> $testing=array_search($testingstring, $dfile);
> print_r ($testing);
> ?>
>
> This is the exact line from the $cfg file that I am searching for:
> #this,line,is,for,ian
>
>
> It doesnt work, it doesnt return anything. Anyone know why? I cant figure
it
> out.
>
> Thanks alot.
>
> Ian