| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
As obvious as it may seem, it might still be useful to point out that return called without any value returns null.
<?php
function test() {
return;
}
print gettype(test()) . "\n";
print (test()?'true':'false') . "\n";
print (!test()?'true':'false') . "\n";
print (test() === false?'true':'false') . "\n";
?>
This returns:
NULL
false
true
false
----
Server IP: 92.48.74.199
Probable Submitter: 88.211.33.26
----
Manual Page -- http://www.php.net/manual/en/function.return.php
Edit -- https://master.php.net/note/edit/86193
Del: integrated -- https://master.php.net/note/delete/86193/integrated
Del: useless -- https://master.php.net/note/delete/86193/useless
Del: bad code -- https://master.php.net/note/delete/86193/bad+code
Del: spam -- https://master.php.net/note/delete/86193/spam
Del: non-english -- https://master.php.net/note/delete/86193/non-english
Del: in docs -- https://master.php.net/note/delete/86193/in+docs
Del: other reasons-- https://master.php.net/note/delete/86193
Reject -- https://master.php.net/note/reject/86193
Search -- https://master.php.net/manage/user-notes.php