|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-07-18 09:09 UTC] peter dot farr at eds dot com
No doubt there is a reason for: print_r(TRUE) displays 1 print_r(FALSE) displays nothing But too me, it just seems inconsistant, bad practise and very confusing. I can find nothing in the documentation I have on, why it is like this, as the text indicates 0 is to FALSE as 1 is to TRUE. It is also obvious from your bug list, that the area of TRUE/FALSE and 1/0 has its problems. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 09:00:02 2025 UTC |
I don't get it, how is this expected behavior? According to the documentation, print_r() "prints human-readable information about a variable" - as such, I can understand why for example strings aren't quoted, meaning you can't tell the difference between the string "1" and the numeric value 1. But from the comments, it sounds like your concerns are about the ability to convert back and forth, rather than producing human-readable output? That's not what print_r() is for - we have var_export() for that. In order to be "human-readable", the following: print_r(array(true, false, null)); Should output: Array ( [0] => TRUE [1] => FALSE [2] => NULL ) And not: Array ( [0] => 1 [1] => [2] => )