note 71292 deleted from function.empty by colder
| From: | colder@php.net | Date: | Tue, 21 Nov 2006 12:58:19 +0000 |
| Subject: | note 71292 deleted from function.empty by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-119938@lists.php.net to get a copy of this message | ||
Note Submitter: tomi dot kaistila at sha dot quessir dot net
Reason: in docs
----
It's good to also note that empty() can only be used on variables. Although this is clearly
said in the documentation, it is easy to forget it and try to directly pass a return value to it
from a function.
e.g.
<?php
include 'class.whois.php';
$whois = new whois();
if(!empty($whois->getWhoami())) {
echo "Could not find you.";
}
?>
This will produce a fatal error enigmatically saying, "Can't use method return value in
write context..."