|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-02-01 05:42 UTC] aharvey@php.net
-Status: Open
+Status: Wont fix
[2011-02-01 05:42 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 22:00:01 2025 UTC |
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