Req #77532 [Com]: foreach just over keys

From: Date: Mon, 28 Jan 2019 00:38:42 +0000
Subject: Req #77532 [Com]: foreach just over keys
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-1379@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77532&edit=1 ID: 77532 Comment by: danack@php.net 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

« previous php.standards (#1379) next »