Req #79421 [NEW]: foreach (array_keys($arr) as $k) is slow
From: michael dot vorisek at email dot cz
Operating system:
PHP version: 7.4.4
Package: Performance problem
Bug Type: Feature/Change Request
Bug description:foreach (array_keys($arr) as $k) is slow
Description:
------------
This is a feature request to optimize:
foreach (array_keys($arr) as $k) {}
instead of building array of keys optimize this in PHP internally to
behave like:
foreach ($arr as $k => $ignore) {}
It is important to optimize it as foreach on keys is very commonly used.
--
Edit bug report at https://bugs.php.net/bug.php?id=79421&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79421&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79421&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79421&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79421&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79421&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79421&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79421&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79421&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79421&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79421&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79421&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79421&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79421&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79421&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79421&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79421&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79421&r=mysqlcfg
Thread (4 messages)
- michael dot vorisek at email dot cz