3v4l.org

run code in 300+ PHP versions simultaneously
<?php $as = [ [3, 4, 2, 5, 1], ['p', 'h', 'p'], [5, 2, 1, 4, 3], ]; $x = sort_foreach($as); $y = sort_array_map($as); $z = sort_array_walk($as); var_dump($x === $y && $x === $z && $y === $z); //var_dump($x, $y, $z); function sort_foreach(array $as) { foreach ($as as $k => $a) { sort($a); $as[$k] = $a; } return $as; } function sort_array_map(array $as) { return array_map(function ($a) { sort($a); return $a; }, $as); } function sort_array_walk(array $as) { array_walk($as, function (&$a) { sort($a); }); return $as; }

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)
8.3.60.0140.00416.75
8.3.50.0060.01218.20
8.3.40.0110.00418.97
8.3.30.0160.00318.52
8.3.20.0040.00419.06
8.3.10.0080.00020.90
8.3.00.0050.00323.52
8.2.180.0040.01118.54
8.2.170.0070.00722.96
8.2.160.0120.00820.35
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0060.00321.12
8.2.120.0060.00326.35
8.2.110.0030.00722.21
8.2.100.0090.00318.03
8.2.90.0060.00319.34
8.2.80.0000.00817.97
8.2.70.0050.00518.05
8.2.60.0000.00817.93
8.2.50.0030.00618.10
8.2.40.0080.00019.32
8.2.30.0030.00519.49
8.2.20.0050.00518.22
8.2.10.0050.00318.15
8.2.00.0040.00419.38
8.1.280.0110.00325.92
8.1.270.0080.00022.01
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0000.00922.56
8.1.230.0110.00317.89
8.1.220.0000.01117.80
8.1.210.0030.00618.77
8.1.200.0000.00917.47
8.1.190.0030.00617.13
8.1.180.0000.01118.10
8.1.170.0030.00618.38
8.1.160.0030.00718.91
8.1.150.0040.00418.86
8.1.140.0040.00417.61
8.1.130.0030.00320.79
8.1.120.0000.00717.50
8.1.110.0070.00317.36
8.1.100.0000.00717.51
8.1.90.0000.00717.50
8.1.80.0040.00417.50
8.1.70.0030.00317.52
8.1.60.0000.00917.61
8.1.50.0070.00017.53
8.1.40.0030.00617.48
8.1.30.0080.00017.64
8.1.20.0030.00517.63
8.1.10.0060.00317.57
8.1.00.0000.00917.56
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0070.00018.37
8.0.270.0000.00717.29
8.0.260.0040.00417.20
8.0.250.0080.00016.97
8.0.240.0000.00716.91
8.0.230.0050.00217.01
8.0.220.0000.00816.86
8.0.210.0000.00717.04
8.0.200.0070.00016.93
8.0.190.0090.00017.01
8.0.180.0090.00016.84
8.0.170.0000.00916.93
8.0.160.0000.00716.92
8.0.150.0030.00316.74
8.0.140.0030.00516.92
8.0.130.0050.00013.35
8.0.120.0040.00416.86
8.0.110.0040.00416.82
8.0.100.0040.00416.68
8.0.90.0040.00416.79
8.0.80.0050.01116.89
8.0.70.0000.00716.73
8.0.60.0040.00416.75
8.0.50.0040.00416.86
8.0.30.0050.01417.21
8.0.20.0110.00817.40
8.0.10.0040.00417.03
8.0.00.0070.01116.83
7.4.330.0030.00315.55
7.4.320.0030.00316.66
7.4.300.0000.00616.66
7.4.290.0070.00016.45
7.4.280.0020.00516.41
7.4.270.0090.00016.54
7.4.260.0030.00316.61
7.4.250.0000.00716.62
7.4.240.0030.00316.57
7.4.230.0030.00516.52
7.4.220.0080.00016.58
7.4.210.0120.00616.72
7.4.200.0030.00316.40
7.4.160.0100.00716.52
7.4.140.0110.01017.86
7.4.130.0070.01016.48
7.4.120.0120.00816.53
7.4.110.0100.00716.61
7.4.100.0070.01016.63
7.4.90.0060.01216.58
7.4.80.0150.00819.39
7.4.70.0100.01016.67
7.4.60.0090.01316.63
7.4.50.0140.00316.56
7.4.40.0110.00816.59
7.4.00.0090.00815.04
7.3.330.0000.00513.31
7.3.320.0000.00513.37
7.3.310.0030.00316.35
7.3.300.0000.00616.41
7.3.290.0030.00316.38
7.3.280.0110.01016.33
7.3.260.0090.00816.43
7.3.240.0080.00916.59
7.3.230.0040.01416.46
7.3.210.0070.01116.31
7.3.200.0070.01016.36
7.3.190.0120.00616.37
7.3.180.0060.01016.40
7.3.170.0130.00316.52
7.3.160.0120.01216.31
7.3.120.0140.00014.79
7.3.110.0060.00915.04
7.3.100.0120.00414.82
7.3.90.0040.01114.77
7.3.80.0030.01114.71
7.3.70.0040.01214.71
7.3.60.0030.01014.91
7.3.50.0060.00314.79
7.3.40.0090.00614.71
7.3.30.0060.00614.71
7.3.20.0030.01416.41
7.3.10.0070.00716.77
7.3.00.0110.00016.71
7.2.330.0030.01616.70
7.2.320.0140.01216.71
7.2.310.0060.01216.43
7.2.300.0160.00316.67
7.2.290.0070.01516.88
7.2.250.0070.01315.18
7.2.240.0100.00714.70
7.2.230.0040.01415.07
7.2.220.0060.00915.19
7.2.210.0030.01415.09
7.2.200.0060.00915.08
7.2.190.0070.00714.89
7.2.180.0070.00714.98
7.2.170.0030.00615.17
7.2.70.0340.00515.05
7.2.60.0430.01214.96
7.2.50.0560.00314.92
7.2.40.0390.00915.06
7.2.30.0390.00915.00
7.2.20.0400.00715.04
7.2.10.0400.00415.06
7.2.00.0460.00814.99
7.1.330.0030.01015.66
7.1.320.0030.01015.82
7.1.310.0060.01015.62
7.1.300.0100.00315.61
7.1.290.0040.01115.85
7.1.280.0030.00715.73
7.1.270.0060.00615.64
7.1.260.0040.01215.48
7.1.200.0060.00615.57
7.1.170.0480.00713.74
7.1.160.0340.01013.85
7.1.150.0410.00413.85
7.1.140.0360.00913.86
7.1.130.0330.00913.91
7.1.120.0380.00913.94
7.1.110.0370.00513.85
7.1.100.0330.00914.08
7.1.90.0500.00513.68
7.1.80.0670.00714.02
7.1.70.0430.00913.86
7.1.60.0620.01031.82
7.1.50.1290.01431.81
7.1.40.0900.01031.86
7.1.30.0920.01131.75
7.1.20.0820.01031.67
7.1.10.0520.00913.81
7.1.00.0470.00813.69

preferences:
34.33 ms | 400 KiB | 5 Q