Bug #13859 Updated: Change (string)false from "" to "0"
| From: | jeroen@php.net | Date: | Sun, 28 Oct 2001 17:36:40 +0000 |
| Subject: | Bug #13859 Updated: Change (string)false from "" to "0" | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69203@lists.php.net to get a copy of this message | ||
ID: 13859
Updated by: jeroen
Reported By: perry@globalnet.co.uk
Old Summary: Inconsistent display of logical results
Old Status: Open
Status: Closed
Old Bug Type: Performance problem
Bug Type: Feature/Change Request
Operating System: Windows95
PHP Version: 4.0.6
New Comment:
Reclassified and updated summary. But it's not going to happen, therefore closed. There are
numerous reasons for todays behaviour.
use var_dump anyway if you are interested in the value of an expression, and/or if() or something
alike if you want to use the truth value of a variable.
See also: http://www.php.net/types
Previous Comments:
------------------------------------------------------------------------
[2001-10-28 12:22:40] perry@globalnet.co.uk
<?php
$n1=10;
$n2=8;
echo '$n1<$n2 is '.($n1<$n2)."<br>";
echo '$n1<=$n2 is '.($n1<=$n2)."<br>";
echo '$n1>$n2 is '.($n1>$n2)."<br>";
echo '$n1>=$n2 is '.($n1>=$n2)."<br>";
echo '$n1==$n2 is '.($n1==$n2)."<br>";
echo '$n1!=$n2 is '.($n1!=$n2)."<br>";
echo '$n1<>$n2 is '.($n1<>$n2)."<br>";
echo '$n1===$n2 is '.($n1===$n2)."<br>";
echo '$n1!==$n2 is '.($n1!==$n2)."<br>";
echo "<br>";
$bool=($n1==$n2 || $n1===$n2);
echo '$bool=($n1==$n2 || $n1===$n2);'."<br>";
echo '$bool is '.$bool;
?>
---
This code is a simple run-through of the logical operators. The problem is that 0 is never displayed
normally, but if you use boolean logic, then it is possible for 0 to be displayed. I prefer the 0
being displayed.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13859&edit=1