| Newsgroups |
php.standards |
| Message-ID |
<[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=77532&edit=1
ID: 77532
Comment by: [email protected]
Reported by: jerry at jmweb dot net
Summary: foreach just over keys
Status: Open
Type: Feature/Change Request
Package: PHP Language Specification
Operating System: n/a
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
> but I will let the community decide on the specifics.
How about using '$noop' ?
In which case, the feature is complete.
Previous Comments:
------------------------------------------------------------------------
[2019-01-28 00:24:43] jerry at jmweb dot net
Description:
------------
Too often I do something like:
foreach( $array as $key => $noop )
{
// do something with $key only
}
Why not use array_keys? Well, I guess to avoid the overhead of calling a function. It would be super if we could simply do:
foreach( $array as $key => null )
{
// do something with $key only
}
I am not 100% set on using null, but I will let the community decide on the specifics.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77532&edit=1