3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { private $a = [ 'foo-test' => [1], '-' => [2], 'bar-test' => [3] ]; private function _mySort($x, $y) { if (!isset($this->a[$x])) { throw new Exception('Missing X: "' . $x . '"'); } if (!isset($this->a[$y])) { throw new Exception('Missing Y: "' . $y . '"'); } return $x < $y; } public function __construct() { uksort($this->a, [$this, '_mySort']); } } // new myClass(); $a = ['foo-test' => [1], '-' => [2], 'bar-test' => [3]]; uksort($a, function($x, $y) { if (!isset($a[$x])) { throw new Exception('Missing X: "' . $x . '"'); } if (!isset($a[$y])) { throw new Exception('Missing Y: "' . $y . '"'); } return $x < $y; } });

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.0.20.0330.08020.10
7.0.10.0170.06020.21
7.0.00.0000.05020.32
5.6.170.0170.05020.40
5.6.160.0000.09020.38
5.6.150.0070.08318.27
5.6.140.0070.08018.14
5.6.130.0100.03318.20
5.6.120.0130.04321.00
5.6.110.0170.07321.01
5.6.100.0130.05720.97
5.6.90.0030.09021.01
5.6.80.0130.07320.39
5.5.310.0270.06720.30
5.5.300.0200.07017.98
5.5.290.0030.08017.97
5.5.280.0030.04720.88
5.5.270.0100.08720.77
5.5.260.0030.07720.74
5.5.250.0100.06720.62
5.5.240.0200.07720.25

preferences:
148.22 ms | 1386 KiB | 7 Q