Which “false” is it?
dionyziz@turing ~ $ cat test.php
<?php
class false {
}
$c = New false();
echo get_class( $c );
?>
dionyziz@turing ~ $ php test.php
false
dionyziz@turing ~ $
This entry was posted
on Tuesday, May 27th, 2008 at 8:38 pm and is filed under PHP.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
the one you created, as get_class( false ) does not return “false”
and $c = New false(); would be a fatal error if you did not
declare your own false class
Obviously, but that’s still kinda weird that it allows me to declare such a class, don’t you think?
“true” and “false” are not reserved words in PHP. They are globally-defined constants according to PHP.net.
http://www.php.net/manual/en/reserved.php
Neither in Python, “True” and “False” are reserved keywords. They are just two predefined variables, whose value can change during runtime, or new classes can be defined with their names, etc.