3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (substr(PHP_VERSION, 0, 5) !== '7.1.6') die('Meh'); function test($label = '') { global $t; $t2 = microtime(1); if ($label) echo str_pad($label . ': ', 32, '.', STR_PAD_RIGHT) . ' ' . 1000 * ($t2 - $t) . 'ms' . "\n"; $t = $t2; } $c = 300; $c2 = 3000; test(); for ($i = $c; $i--;) { for ($j = $c2; $j--;) { $a = [0, 1, 2, 3, 4]; unset($a[0]); } } test('unset list => map'); for ($i = $c; $i--;) { for ($j = $c2; $j--;) { $a = ['c' => 0, 1, 2, 3, 4]; unset($a['c']); } } test('unset map => list'); for ($i = $c; $i--;) { for ($j = $c2; $j--;) { $a = ['c' => 0, 'd' => 1, 2, 3, 4]; unset($a['c']); } } test('unset map => map');
Output for 7.1.6
unset list => map: ............. 70.497035980225ms unset map => list: ............. 97.955942153931ms unset map => map: .............. 117.79403686523ms