Req #81561 [NEW]: Optimize `count` calls in conditions
| From: | lars at moelleken dot org | Date: | Thu, 28 Oct 2021 12:48:49 +0000 |
| Subject: | Req #81561 [NEW]: Optimize `count` calls in conditions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237415@lists.php.net to get a copy of this message | ||
From: lars at moelleken dot org
Operating system:
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Optimize
count calls in conditions
Description:
------------
While optimising (reducing) some count calls in phpstan-src, I
thought: "Why do php count the full array in simpel conditions? Or is it
already optimized?"
Example: if (count($x) === 1)
--
Edit bug report at https://bugs.php.net/bug.php?id=81561&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81561&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81561&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81561&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81561&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81561&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81561&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81561&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81561&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81561&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81561&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81561&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81561&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81561&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81561&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81561&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81561&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81561&r=mysqlcfg