try it like this:
switch(true){
case strstr($line,"zip"):
echo "found zip";
break;
}
On Thu, 7 Feb 2002 14:29:45 -0600, Chuck Barnett wrote:
>Hello, I am trying to find out if a string is in a line being read
>from a
>file. I should use strstr for this I am pretty sure.
>I want to do something like this: switch(strstr($line, case
>argument)) but
>I don't know if it is possible. For example, I am looking for Zip
>in a line
>but it will not find it using the code below. Any suggestions? I
>know I am
>being as clear as mud on this :)
>
>$fd = fopen("mls1.txt", "r");
>while(!feof($fd))
> {
> $line=fgets($fd, 4096);
> switch($line)
> {
> case "Zip":
> echo "found zip";
> //$line2=fgets($fd,4096);
> $zip=$line;
> break;
>
> case "Remarks":
> //$line2=fgets($fd,4096);
> $neighborhood=$line;
> break;
>
> case "Taxes":
> //$line2=fgets($fd,4096);
> $address=$line;
> break;
>
> }
>
> }
>fclose($fd);
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php