Re: Getting false positive on strpos ... despite doublecheck... HELP!
| From: | -{ Rene Brehmer }- | Date: | Tue, 18 Mar 2003 17:40:48 +0000 |
| Subject: | Re: Getting false positive on strpos ... despite doublecheck... HELP! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140147@lists.php.net to get a copy of this message | ||
On Mon, 17 Mar 2003 05:40:05 -0800 (PST), Rasmus Lerdorf wrote about "Re:
[PHP] Getting false positive on strpos ... despite doublecheck... HELP!"
what the universal translator turned into this:
>> case strpos($line,"#date:") == 0 &&
>> strpos($line,"#date:") !== false:
>
>You can just do a === 0 check here, you don't need the second
>check to make sure it isn't false. However, that's not really how you use
>a switch expression anyway. The expressions in the case statement should
>be constants. If you rewrite your code to look like this it will work
>fine:
10-4 ... didn't know that ...
But what's with the continue commands in your rewrite -
haven't seen them before ... What do they do?
> while (! feof($fp)) {
> $line = fgets($fp, 4096);
> if(substr($line,0,6)=='#date:') {
> $print = strtr(substr($line, 7),"\r\n"," ");
> $print = date("j F Y H.i.s O",strtotime(trim($print)));
> echo "<span class=\"ylwbld\">On $print, ";
> continue;
> }
Do they cause the same behaviour as an if ... elseif structure???
But thanks ... will change it ASAP ...
Rene
--
Rene Brehmer
This message was written on 100% recycled spam.
Come see! My brand new site is now online!
http://www.metalbunny.net