note 85854 added to function.function-exists
| From: | zach at bygeekz dot com | Date: | Sun, 21 Sep 2008 01:20:41 +0000 |
| Subject: | note 85854 added to function.function-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144583@lists.php.net to get a copy of this message | ||
to php at fluidthoughts dot com
you aren't comparing against false, that if compares against true, so it's going to return
that, as false != true
true being 1, True, (bool)True, etc.
false being 0, False, Null, etc
<?php
$foo=null;
if ($foo) { echo 'yay'; } //does not echo yay, because null is not True
$foo=false;
if ($foo) { echo 'yay'; } //does not echo yay, because false is not True
$foo=null;
if (!$foo) { echo 'yay'; } //echoes yay!
$foo=false;
if (!$foo) { echo 'yay'; } //echoes yay!
?>
This..
<?php
if (!function_exists('')) {
echo "empty string function doesnt exist as compared as negative\n";
}
if (!function_exists(NULL)) {
echo "NULL function doesnt exist as compared as negative\n";
}
?>
Works.
Alternatively, to enter upon existance..
Use your code. Since they dont exist, it wont enter..
----
Server IP: 209.41.74.194
Probable Submitter: 24.30.66.76
----
Manual Page -- http://www.php.net/manual/en/function.function-exists.php
Edit -- https://master.php.net/note/edit/85854
Del: integrated -- https://master.php.net/note/delete/85854/integrated
Del: useless -- https://master.php.net/note/delete/85854/useless
Del: bad code -- https://master.php.net/note/delete/85854/bad+code
Del: spam -- https://master.php.net/note/delete/85854/spam
Del: non-english -- https://master.php.net/note/delete/85854/non-english
Del: in docs -- https://master.php.net/note/delete/85854/in+docs
Del: other reasons-- https://master.php.net/note/delete/85854
Reject -- https://master.php.net/note/reject/85854
Search -- https://master.php.net/manage/user-notes.php