Created
November 8, 2022 20:37
-
-
Save atakde/89e7aa7740b220eb61d1e18a7842c015 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $array = []; | |
| for ($i = 0; $i < 10000; $i++) { | |
| $array[] = $i; | |
| } | |
| $start = microtime(true); | |
| foreach ($array as $k => $v) { | |
| // empty code. | |
| } | |
| echo "Completed in ", microtime(true) - $start, " Seconds\n"; | |
| $start = microtime(true); | |
| foreach ($array as $k => &$v) { | |
| // empty code. | |
| } | |
| echo "Completed in ", microtime(true) - $start, " Seconds\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment