Req #63317 [Opn->Wfx]: Add alternate, more logical foreach syntax

From: Date: Fri, 15 Mar 2013 14:24:48 +0000
Subject: Req #63317 [Opn->Wfx]: Add alternate, more logical foreach syntax
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-177804@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63317&edit=1

 ID:                 63317
 Updated by:         nikic@php.net
 Reported by:        evertvandansen at ymail dot com
 Summary:            Add alternate, more logical foreach syntax
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   Any
 PHP Version:        5.4.8
 Block user comment: N
 Private report:     N

 New Comment:

Don't think this will happen as it doesn't have any (quantifiable) advantages over the
current syntax but would a) introduce two ways to do the same thing and b) add a new keyword that is
very likely be currently in use. Marking Won't Fix.


Previous Comments:
------------------------------------------------------------------------
[2012-10-20 11:19:51] evertvandansen at ymail dot com

Description:
------------
This is a very low priority request for adding an alternate foreach syntax. Right 
now we write something like:
foreach ($cats as $cat)
Which is fine, but neither semantically nor grammatically correct. I would propose 
that 
foreach ($cat in $cats) or foreach ($cat from $cats)
makes much more sense and is more readable. Not just from a grammatical point of 
view, but also because that way the actual identifier you use in the iteration is 
placed first.
The existing syntax should obviously remain, it is simply an alternate syntax, not 
meant to substitute.
Again, it is not a very important request as it does not improve PHP technically, 
only in regards to readability and (for some) usability.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63317&edit=1


Thread (2 messages)

« previous php.bugs (#177804) next »