3v4l.org

run code in 300+ PHP versions simultaneously
<?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 = 30; $c2 = 30; 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');

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.1.60.0170.01335.10

preferences:
33.05 ms | 400 KiB | 5 Q