From: Operating system: All PHP version: 5.3.5 Package: Scripting Engine problem Bug Type: Feature/Change Request Bug description:return/break types "if"
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 bug report at http://bugs.php.net/bug.php?id=53896&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53896&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53896&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53896&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53896&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53896&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53896&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53896&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53896&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53896&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53896&r=support Expected behavior: http://bugs.php.net/fix.php?id=53896&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53896&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53896&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53896&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53896&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53896&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53896&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53896&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53896&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53896&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53896&r=mysqlcfg