note 120456 deleted from function.strlen by cmb
| From: | cmb@php.net | Date: | Sun, 25 Jul 2021 14:15:15 +0000 |
| Subject: | note 120456 deleted from function.strlen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216646@lists.php.net to get a copy of this message | ||
Note Submitter: Pelle_Gris
----
A strong advice: Never-Ever use "strlen" in intensive loop iterations (or similar), like
this..
for ($i = 0; $i < strlen($crc); $i++) .....
It is notorious slow...
This construct will use cpu each time to get the string length at each loop. Instead save the length
in a variable and use that in the "for" loop. Note that You must not change the string
length inside the loop then..).