PHP 4.0 Bug #5537: problem with value false returning from strpos() function
| From: | sat at 3wdesign dot es | Date: | Wed, 12 Jul 2000 22:30:18 +0000 |
| Subject: | PHP 4.0 Bug #5537: problem with value false returning from strpos() function | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-24231@lists.php.net to get a copy of this message | ||
From: sat@3wdesign.es
Operating system: Linux Debian 2.1
PHP version: 4.0.0
PHP Bug Type: Other
Bug description: problem with value false returning from strpos() function
<?
$string = "FOO STRING";
$string1 = "FOO";
$string2 = "OO";
$string3 = "ZOO";
$value1 = strpos($string,$string1,0);
$value2 = strpos($string,$string2,0);
$value3 = strpos($string,$string3,0);
for ($i=1;$i<=3;$i++) {
if (${value.$i}>=0) {
echo "string".$i." found at:".${value.$i}."<br>";
}
elseif (${value.$i}==FALSE) {
echo "string".$i." not found.<br>";
}
}
?>
$value3>=0 and $value3==FALSE are equivalent and so we can not distinguish between string
found at position 0 and string not found.
strpos should return -1 when the string was not found.