php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43767 Symbolic constant FALSE handled differently to TRUE
Submitted: 2008-01-06 14:15 UTC Modified: 2008-01-06 14:26 UTC
From: scratch65535 at att dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: w2ksp4
Private report: No CVE-ID: None
 [2008-01-06 14:15 UTC] scratch65535 at att dot net
Description:
------------
The symbolic constants FALSE and TRUE are treated differently, but should be treated the same.  

The principle of symbolic constants is that, during translation, the value for which they stand is substituted everywhere they appear.  This principle is universally taught in texts, and I cannot think of a single language, from various assembly languages on up, where it is not true.

The PHP documentation has nothing to say that would lead anyone to think that PHP is intended to work differently.  What would be the advantage in making it work so differently?

Reproduce code:
---------------
echo false ;
echo (false) ;
echo false+false ;
echo (false+false) ;
echo intval(false) ;
echo '"'.false.'"' ;

echo true ;
echo (true) ;
echo true+true ;
echo (true+true) ;
echo intval(true) ;
echo '"'.true.'"' ;



Expected result:
----------------
00000"0"11221"1"

Actual result:
--------------
000""11221"1"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-06 14:26 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Please read about the PHP type system.
http://de.php.net/manual/en/language.types.type-juggling.php

And please don\'t open yet another bug but check other _support_ channels (like the php generals list) if you have further questions.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 11 23:00:01 2025 UTC