|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-10-14 11:44 UTC] php dot net at b-a-l-u dot de
Description: ------------ http://www.php.net/manual/en/function.ini-get.php tells me that "When querying boolean values: A boolean ini value of off will be returned as an empty string while a boolean ini value of on will be returned as "1"." But echo '['.ini_get('register_globals').']'; displays '[0]' not '[]'? At least this is the behaviour I have with php-4.1.2 on debian woody. Balu PS: It'd be nice to add the hint of "beyer at <nospam>clickhand dot de" from the notes on that page regarding casting the value using (bool) to the main description. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 17:00:01 2025 UTC |
# php -r "var_dump(ini_get('register_globals'));" string(0) ""As I said in my opening message the documentation says "When querying boolean values: A boolean ini value of off will be returned as an empty string while a boolean ini value of on will be returned as "1". " So it IS a documentation problem if PHP<5 returns "" or 0 depending on where it got set. I'd expect at least a warning like PHP versions before PHP5 return an empty string or 0 to specify a boolean value of false. The best way to test the return value is to cast it - e.g. $register_globals = (bool) ini_get('register_gobals'); Balu