#50515 [Opn->Bgs]: return() in short-circuit / lazy evaluation

From: Date: Fri, 18 Dec 2009 11:20:05 +0000
Subject: #50515 [Opn->Bgs]: return() in short-circuit / lazy evaluation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145891@lists.php.net to get a copy of this message
ID: 50515 Updated by: jani@php.net Reported By: ntpt at seznam dot cz -Status: Open +Status: Bogus -Bug Type: *Programming Data Structures +Bug Type: Feature/Change Request Operating System: linux PHP Version: 5.2.12 New Comment: Never happens. Previous Comments: ------------------------------------------------------------------------ [2009-12-18 10:26:52] ntpt at seznam dot cz Description: ------------ please allow return() in lazy evaluation /short-circuit syntax like $result=do_something($blah) or die('nothing done'); // this works but $result=do_something($blah) or return(false) ; // does NOT work I thing it is prety legitimate not only to call die() if do_something() return false, but in this case return() from function or include() as well. I thing it is more cleaner and readable then bunch of $result=do_something($blah) if ($result==false){ return false;} // use you result here Maybe even codeblock after "or" is worth of considerations $result=do_something($blah) or { // codeblock, do what you want here } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50515&edit=1

« previous php.bugs (#145891) next »