Date: 10/05/02
- Next message: rasmus <email protected>: "[PHP-DOC] #18411 [Opn]: print_r(FALSE) not consistant with print_r(TRUE)"
- Previous message: iliaa <email protected>: "[PHP-DOC] #19575 [Opn->Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Next in thread: jc <email protected>: "[PHP-DOC] #19575 [Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Maybe reply: jc <email protected>: "[PHP-DOC] #19575 [Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 19575
Updated by: goba <email protected>
Reported By: jc <email protected>
Status: Duplicate
Bug Type: Documentation problem
Operating System: Red Hat Linux 7.2
PHP Version: 4.2.3
New Comment:
This feature(!) is there so you can convert from booleans to strings,
then back to booleans or to integers and then to booleans, and you get
the same boolean you started from...
boolean -> string -> boolean
TRUE "1" TRUE
FALSE "" FALSE
boolean -> string -> integer -> boolean
TRUE "1" 1 TRUE
FALSE "" 0 FALSE
In php code:
$false_bool = (boolean) (int) (string) FALSE;
Goba
Previous Comments:
------------------------------------------------------------------------
[2002-10-05 09:58:17] iliaa <email protected>
Dupe of bug #18411
------------------------------------------------------------------------
[2002-09-24 06:56:43] jc <email protected>
A boolean of TRUE will print as "1" whereas FALSE prints as ""
This has caused me a problem since I had assume that TRUE would print
as TRUE and FALSE would print as FALSE.
Could you add this to the documentation. I could understand 1/0,
TRUE/FALSE, but "1"/"" is not evident at first.
I'd even suggest a change request that booleans print out as TRUE/FALSE
(since booleans really should not be 1/0 integers or empty/non-empty
strings but BOOLEANS) but I'm sure that would ge shot down. :)
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=19575&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: rasmus <email protected>: "[PHP-DOC] #18411 [Opn]: print_r(FALSE) not consistant with print_r(TRUE)"
- Previous message: iliaa <email protected>: "[PHP-DOC] #19575 [Opn->Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Next in thread: jc <email protected>: "[PHP-DOC] #19575 [Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Maybe reply: jc <email protected>: "[PHP-DOC] #19575 [Dup]: Boolean prints 1 for TRUE but nothing for FALSE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

