PHP 4.0 Bug #4202 Updated: if interprets "0" as "false" even when checking for "numeric value" vs "false"
| From: | Bug Database | Date: | Thu, 20 Apr 2000 18:21:17 +0000 |
| Subject: | PHP 4.0 Bug #4202 Updated: if interprets "0" as "false" even when checking for "numeric value" vs "false" | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18071@lists.php.net to get a copy of this message | ||
ID: 4202
User Update by: shh@enovia.com
Status: Open
Bug Type: Misbehaving function
Description: if interprets "0" as "false" even when checking for "numeric
value" vs "false"
This script works properly on PHP4:
$string_1="<test>";
$string_2="test";
print("strrpos returns:
\"".strrpos($string_1,"<")."\"<br>");
if(strrpos($string_1,"<")===0) print "string_1 if is true<br>"; else
print "string_1 if is false<br>";
print("strrpos returns:
\"".strrpos($string_2,"<")."\"<br>");
if(strrpos($string_2,"<")===0) print "string_2 if is true<br>"; else
print "string_2 if is false<br>";
Full Bug description available at: http://bugs.php.net/?id=4202