php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13859 Change (string)false from "" to "0"
Submitted: 2001-10-28 12:22 UTC Modified: 2001-10-28 12:36 UTC
From: perry at globalnet dot co dot uk Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Windows95
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: perry at globalnet dot co dot uk
New email:
PHP Version: OS:

 

 [2001-10-28 12:22 UTC] perry at globalnet dot co dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-28 12:36 UTC] jeroen@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC