note 86193 added to function.return

From: Date: Tue, 07 Oct 2008 16:26:23 +0000
Subject: note 86193 added to function.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-145130@lists.php.net to get a copy of this message
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

« previous php.notes (#145130) next »