Skip to content

Instantly share code, notes, and snippets.

@kaja47
Last active December 31, 2016 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaja47/31e741552085437dc367 to your computer and use it in GitHub Desktop.
Save kaja47/31e741552085437dc367 to your computer and use it in GitHub Desktop.
soon in PHP 7
<?php
// really really fast loop (0.008s)
$arr = range(1, pow(2, 24)+1);
for ($i = 1; $i < 200000; $i++) {
unset($arr[$i]);
$arr[] = 1;
}
// really really slow loop (0.38s)
$arr = range(1, pow(2, 24)-1);
for ($i = 1; $i < 200000; $i++) {
unset($arr[$i]);
$arr[] = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment