3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('PHP_EOL')) { define('PHP_EOL', "\n"); } function printPerson($person) { echo sprintf( "Name: %s | Age: %s | Color: %s" . PHP_EOL, $person["name"], $person["age"], $person["colour"] ); } $people = array( array("name"=>"Bob","age"=>8,"colour"=>"red"), array("name"=>"Greg","age"=>12,"colour"=>"blue"), array("name"=>"Andy","age"=>5,"colour"=>"purple") ); $arrSortArray = array(); foreach($people as $person) { foreach($person as $key=>$value){ if(!isset($arrSortArray[$key])){ $arrSortArray[$key] = array(); } $arrSortArray[$key][] = $person; } } $orderby = "age"; //change this to whatever key you want from the array echo 'BEFORE SORT' . PHP_EOL; foreach ($arrSortArray[$orderby] as $person) { printPerson($person); } array_multisort($arrSortArray[$orderby], SORT_ASC,$people); echo '------------------------' . PHP_EOL; echo 'AFTER SORT' . PHP_EOL; foreach ($arrSortArray[$orderby] as $person) { printPerson($person); }

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.0110.00318.68
8.3.50.0160.00622.18
8.3.40.0110.00418.79
8.3.30.0150.00419.09
8.3.20.0040.00420.34
8.3.10.0000.00920.65
8.3.00.0040.00419.38
8.2.180.0140.00716.73
8.2.170.0100.00722.96
8.2.160.0050.00820.47
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00022.05
8.2.110.0070.00321.96
8.2.100.0080.00417.97
8.2.90.0050.00317.50
8.2.80.0000.00917.97
8.2.70.0030.00618.02
8.2.60.0030.00718.04
8.2.50.0050.00318.10
8.2.40.0060.00320.59
8.2.30.0000.00719.48
8.2.20.0040.00417.72
8.2.10.0050.00318.05
8.2.00.0000.00717.80
8.1.280.0060.01525.92
8.1.270.0040.00421.93
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00423.98
8.1.230.0000.01119.19
8.1.220.0000.00917.74
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0090.00017.23
8.1.180.0080.00318.10
8.1.170.0050.00318.42
8.1.160.0000.00821.98
8.1.150.0040.00418.93
8.1.140.0060.00317.35
8.1.130.0070.00017.84
8.1.120.0000.00717.38
8.1.110.0040.00417.46
8.1.100.0050.00217.48
8.1.90.0030.00317.46
8.1.80.0030.00517.46
8.1.70.0030.00317.41
8.1.60.0040.00417.46
8.1.50.0060.00317.59
8.1.40.0000.00717.39
8.1.30.0030.00517.52
8.1.20.0040.00417.54
8.1.10.0030.00517.55
8.1.00.0000.00717.52
8.0.300.0090.00019.50
8.0.290.0040.00416.88
8.0.280.0000.00618.45
8.0.270.0080.00017.11
8.0.260.0040.00417.25
8.0.250.0030.00317.02
8.0.240.0040.00416.95
8.0.230.0000.00717.05
8.0.220.0030.00316.83
8.0.210.0070.00016.99
8.0.200.0000.00717.00
8.0.190.0050.00216.97
8.0.180.0000.00817.00
8.0.170.0050.00317.01
8.0.160.0000.00716.93
8.0.150.0000.00716.89
8.0.140.0040.00416.88
8.0.130.0000.00813.47
8.0.120.0050.00316.93
8.0.110.0040.00416.87
8.0.100.0040.00416.84
8.0.90.0040.00416.84
8.0.80.0100.01316.95
8.0.70.0050.00316.87
8.0.60.0000.00716.79
8.0.50.0000.00817.01
8.0.30.0110.00817.27
8.0.20.0130.00517.40
8.0.10.0030.00517.13
8.0.00.0100.00616.78
7.4.330.0000.00615.13
7.4.320.0030.00316.45
7.4.300.0030.00316.61
7.4.290.0000.00716.55
7.4.280.0040.00416.59
7.4.270.0030.00316.46
7.4.260.0020.00516.53
7.4.250.0040.00416.36
7.4.240.0050.00216.47
7.4.230.0030.00316.39
7.4.220.0120.00616.52
7.4.210.0040.01216.70
7.4.200.0030.00316.50
7.4.160.0070.01416.59
7.4.150.0180.00617.40
7.4.140.0090.01117.86
7.4.130.0070.01016.43
7.4.120.0140.00416.47
7.4.110.0100.01316.32
7.4.100.0030.01316.47
7.4.90.0100.00716.64
7.4.80.0100.01319.39
7.4.70.0040.01316.36
7.4.60.0070.01016.50
7.4.50.0060.00316.47
7.4.40.0060.00916.41
7.4.30.0090.00616.58
7.4.00.0000.01014.99
7.3.330.0030.00313.28
7.3.320.0000.00513.42
7.3.310.0030.00316.32
7.3.300.0000.00716.29
7.3.290.0110.00616.48
7.3.280.0080.00816.41
7.3.270.0040.01517.40
7.3.260.0080.01116.51
7.3.250.0080.00816.34
7.3.240.0070.01016.62
7.3.230.0130.00316.39
7.3.210.0120.00616.61
7.3.200.0080.01119.39
7.3.190.0040.01716.49
7.3.180.0140.00316.52
7.3.170.0130.00316.51
7.3.160.0160.00016.36
7.2.330.0090.01616.67
7.2.320.0070.01016.69
7.2.310.0060.01216.58
7.2.300.0140.00416.84
7.2.290.0030.01416.64
7.2.00.0000.01519.32
7.1.100.0040.00718.22
7.1.70.0000.00917.07
7.1.60.0000.01417.25
7.1.50.0040.02117.00
7.1.00.0000.07722.26
7.0.200.0000.01416.69
7.0.140.0000.07722.08
7.0.60.0130.06320.05
7.0.50.0170.07318.01
7.0.40.0030.09320.13
7.0.30.0570.04320.06
7.0.20.0430.03720.16
7.0.10.0030.05720.12
7.0.00.0030.08020.08
5.6.280.0030.07721.00
5.6.210.0100.07020.62
5.6.200.0070.08018.16
5.6.190.0100.07320.64
5.6.180.0530.07720.61
5.6.170.0330.05320.50
5.6.160.0130.07720.54
5.6.150.0030.06018.29
5.6.140.0070.04718.12
5.6.130.0130.03318.17
5.6.120.0100.03320.86
5.6.110.0070.06721.05
5.6.100.0100.08021.10
5.6.90.0100.08320.98
5.6.80.0030.04020.29
5.5.350.0200.06320.40
5.5.340.0170.07017.96
5.5.330.0070.04320.27
5.5.320.0270.07720.26
5.5.310.0230.05320.38
5.5.300.0070.07317.98
5.5.290.0070.08317.96
5.5.280.0170.07320.86
5.5.270.0070.04020.87
5.5.260.0170.07020.88
5.5.250.0100.08020.72
5.5.240.0200.07720.07
5.4.450.0300.04719.63
5.4.440.0400.04719.52
5.4.430.0570.04019.45
5.4.420.0300.05019.63
5.4.410.0300.05019.45
5.4.400.0230.04719.45
5.4.390.0070.03319.45
5.4.380.0330.06018.63
5.4.370.0330.05318.54
5.4.360.0530.05018.76
5.4.350.0400.07018.80
5.4.340.0170.06318.59
5.4.320.0080.03812.51
5.4.310.0100.06312.51
5.4.300.0110.06212.51
5.4.290.0100.05812.51
5.4.280.0090.04312.41
5.4.270.0090.03312.41
5.4.260.0050.03812.41
5.4.250.0080.03512.41
5.4.240.0090.03312.41
5.4.230.0040.04212.40
5.4.220.0110.03112.39
5.4.210.0070.03512.39
5.4.200.0080.04012.40
5.4.190.0060.03612.39
5.4.180.0120.03112.39
5.4.170.0040.04412.40
5.4.160.0080.03512.40
5.4.150.0050.03712.40
5.4.140.0080.03612.08
5.4.130.0030.03812.07
5.4.120.0040.03812.02
5.4.110.0060.03812.02
5.4.100.0070.03612.02
5.4.90.0050.04312.02
5.4.80.0140.03712.02
5.4.70.0100.04012.02
5.4.60.0070.03412.02
5.4.50.0060.03512.01
5.4.40.0050.03612.01
5.4.30.0080.03412.00
5.4.20.0090.03312.00
5.4.10.0050.03512.00
5.4.00.0050.03511.48
5.3.290.0080.03712.80
5.3.280.0070.03712.70
5.3.270.0070.03912.72
5.3.260.0120.03812.72
5.3.250.0070.04012.72
5.3.240.0080.03712.72
5.3.230.0070.03812.71
5.3.220.0070.03612.68
5.3.210.0090.04912.68
5.3.200.0120.04112.68
5.3.190.0080.04012.68
5.3.180.0090.03512.67
5.3.170.0060.05812.67
5.3.160.0070.03612.67
5.3.150.0100.03412.67
5.3.140.0060.03912.66
5.3.130.0080.03912.66
5.3.120.0070.05212.66
5.3.110.0070.04212.66
5.3.100.0100.03912.13
5.3.90.0100.03412.11
5.3.80.0070.03512.11
5.3.70.0060.03612.10
5.3.60.0100.05012.09
5.3.50.0080.05012.04
5.3.40.0060.05512.04
5.3.30.0190.08812.00
5.3.20.0130.03711.78
5.3.10.0060.03611.74
5.3.00.0090.04311.73
5.2.170.0080.0359.23
5.2.160.0050.0309.23
5.2.150.0070.0309.23
5.2.140.0070.0299.23
5.2.130.0050.0299.18
5.2.120.0030.0319.19
5.2.110.0060.0289.20
5.2.100.0040.0309.19
5.2.90.0060.0289.19
5.2.80.0050.0309.19
5.2.70.0080.0329.19
5.2.60.0060.0339.14
5.2.50.0070.0319.11
5.2.40.0020.0359.09
5.2.30.0050.0359.06
5.2.20.0090.0309.05
5.2.10.0100.0488.96
5.2.00.0050.0338.82
5.1.60.0080.0288.10
5.1.50.0150.0248.10
5.1.40.0030.0288.08
5.1.30.0120.0288.43
5.1.20.0090.0438.45
5.1.10.0060.0318.18
5.1.00.0060.0288.18
5.0.50.0080.0366.66
5.0.40.0050.0256.52
5.0.30.0070.0316.34
5.0.20.0050.0196.30
5.0.10.0060.0206.27
5.0.00.0050.0456.27
4.4.90.0050.0214.78
4.4.80.0030.0174.75
4.4.70.0060.0144.76
4.4.60.0050.0174.76
4.4.50.0020.0184.77
4.4.40.0050.0264.71
4.4.30.0050.0164.76
4.4.20.0040.0214.84
4.4.10.0040.0214.85
4.4.00.0060.0304.76
4.3.110.0070.0144.67
4.3.100.0070.0134.67
4.3.90.0070.0164.64
4.3.80.0070.0304.58
4.3.70.0060.0204.63
4.3.60.0050.0194.63
4.3.50.0080.0184.63
4.3.40.0040.0254.54
4.3.30.0020.0163.33
4.3.20.0030.0153.30
4.3.10.0040.0143.26
4.3.00.0070.01319.45

preferences:
43.66 ms | 401 KiB | 5 Q