Edit report at http://bugs.php.net/bug.php?id=53896&edit=1
ID: 53896 Updated by: [email protected] Reported by: david71rj at gmail dot com Summary: return/break types "if" -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Scripting Engine problem Operating System: All PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: PHP is not Perl, and doesn't support postfix statement modifiers. This is intentional, and unlikely to change. Previous Comments: ------------------------------------------------------------------------ [2011-02-01 05:39:28] david71rj at gmail dot com Description: ------------ It's a simple feature that PHP can have, if just substitute if+return, for instance to return+if. It's, change to one-line script. See test script and read more... Well, sometimes we need to break function, or while, or foreach, or maybe force continue case somethink occur, a condition. My idea is make this more readable, in an one line script. Instead of: if($a < $b) return; We do: return if $a < $b; Or: return if($a < $b); Maybe only accept a boolean on return: return $a < $b; Then: return true; // do "return" return false; // not do Same to continue: for($i=0; $i<10; $i++){ continue $i === 5; echo $i . "\n"; } It's a valid idea? ^o) Bye. Test script: --------------- http://pastebin.com/fEB8eGxf ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53896&edit=1
