question about switch function

From: Date: Thu, 07 Feb 2002 20:29:45 +0000
Subject: question about switch function
Groups: php.general 
Request: Send a blank email to php-general+get-83909@lists.php.net to get a copy of this message
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);

« previous php.general (#83909) next »