3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'id' => 2, 'position' => 3, ], [ 'id' => 1, 'position' => 2, ], [ 'id' => 1, 'position' => 1, ], [ 'id' => 2, 'position' => 2, ], [ 'id' => 2, 'position' => 1, ], [ 'id' => 1, 'position' => 3, ], ]; usort( $data, function ($a, $b) { if ($a['position'] == $b['position']) { return ($a['id'] < $b['id']) ? -1 : 1;; } return ($a['position'] < $b['position']) ? -1 : 1; } ); usort( $data, function ($a, $b) { if ($a['id'] == $b['id']) { return 0; } return ($a['id'] < $b['id']) ? -1 : 1; } ); var_dump($data);

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.0060.00916.63
8.3.50.0040.01216.50
8.3.40.0120.00318.69
8.3.30.0070.01018.59
8.3.20.0040.00420.29
8.3.10.0040.00421.65
8.3.00.0040.00423.61
8.2.180.0180.00416.75
8.2.170.0150.00022.96
8.2.160.0030.01020.26
8.2.150.0060.00324.18
8.2.140.0060.00924.66
8.2.130.0080.00026.16
8.2.120.0040.00419.48
8.2.110.0040.00420.56
8.2.100.0030.00917.84
8.2.90.0030.00519.29
8.2.80.0070.00417.97
8.2.70.0030.00717.75
8.2.60.0080.00017.68
8.2.50.0040.00418.07
8.2.40.0000.00822.35
8.2.30.0070.00020.71
8.2.20.0040.00417.75
8.2.10.0080.00018.19
8.2.00.0000.00718.19
8.1.280.0110.00425.92
8.1.270.0090.00623.77
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0030.00621.98
8.1.230.0110.00020.86
8.1.220.0080.00017.77
8.1.210.0050.00518.77
8.1.200.0030.00717.36
8.1.190.0000.00817.22
8.1.180.0000.00818.10
8.1.170.0080.00018.50
8.1.160.0060.00620.73
8.1.150.0020.00518.88
8.1.140.0050.00319.69
8.1.130.0030.00317.68
8.1.120.0000.00717.50
8.1.110.0040.00417.50
8.1.100.0030.00517.51
8.1.90.0000.00717.51
8.1.80.0070.00017.36
8.1.70.0030.00317.37
8.1.60.0000.00917.55
8.1.50.0030.00617.58
8.1.40.0030.00517.55
8.1.30.0000.00817.68
8.1.20.0050.00217.56
8.1.10.0060.00317.56
8.1.00.0050.00317.59
8.0.300.0070.00018.77
8.0.290.0040.00416.73
8.0.280.0030.00318.39
8.0.270.0030.00317.11
8.0.260.0000.00717.16
8.0.250.0070.00016.98
8.0.240.0030.00317.02
8.0.230.0030.00316.99
8.0.220.0000.00716.79
8.0.210.0050.00316.91
8.0.200.0000.00716.93
8.0.190.0040.00416.94
8.0.180.0000.00716.81
8.0.170.0030.00616.88
8.0.160.0000.00716.93
8.0.150.0020.00516.76
8.0.140.0030.00516.88
8.0.130.0000.00613.32
8.0.120.0000.00816.89
8.0.110.0000.00716.80
8.0.100.0070.00016.87
8.0.90.0040.00416.79
8.0.80.0070.01116.86
8.0.70.0050.00316.91
8.0.60.0040.00416.89
8.0.50.0040.00417.02
8.0.30.0110.00617.06
8.0.20.0100.01017.40
8.0.10.0000.00816.89
8.0.00.0120.00716.70
7.4.330.0000.00516.79
7.4.320.0030.00316.53
7.4.300.0070.00016.61
7.4.290.0070.00016.62
7.4.280.0040.00516.61
7.4.270.0030.00316.43
7.4.260.0040.00416.61
7.4.250.0000.00816.56
7.4.240.0040.00316.60
7.4.230.0070.00016.63
7.4.220.0160.00316.64
7.4.210.0000.01516.50
7.4.200.0030.00316.60
7.4.160.0070.01116.55
7.4.150.0030.01617.40
7.4.140.0140.01417.86
7.4.130.0060.01416.54
7.4.120.0120.00916.41
7.4.110.0130.00616.47
7.4.100.0070.01116.60
7.4.90.0060.01216.48
7.4.80.0030.01419.39
7.4.70.0100.00716.34
7.4.60.0100.00716.52
7.4.50.0030.01016.46
7.4.40.0030.01316.48
7.4.30.0130.00716.47
7.4.10.0060.01216.77
7.4.00.0030.01315.74
7.3.330.0030.00313.21
7.3.320.0030.00313.30
7.3.310.0040.00416.12
7.3.300.0030.00316.32
7.3.290.0100.00716.28
7.3.280.0080.00816.22
7.3.270.0120.00617.40
7.3.260.0120.00616.47
7.3.250.0070.01016.35
7.3.240.0070.01116.46
7.3.230.0090.00916.39
7.3.210.0070.01516.40
7.3.200.0090.01219.39
7.3.190.0090.01216.57
7.3.180.0190.00516.25
7.3.170.0100.01016.32
7.3.160.0100.00716.43
7.3.130.0070.01116.38
7.3.120.0030.01616.41
7.3.110.0060.01016.34
7.3.100.0050.00516.14
7.3.90.0080.00816.37
7.3.80.0090.00616.18
7.3.70.0080.00416.26
7.3.60.0100.00316.24
7.3.50.0120.00916.38
7.3.40.0120.01016.17
7.3.30.0060.00616.27
7.3.20.0040.01117.97
7.3.10.0060.00618.18
7.3.00.0030.01218.09
7.2.330.0170.00316.80
7.2.320.0210.02716.53
7.2.310.0110.00916.71
7.2.300.0030.01616.80
7.2.290.0120.00616.57
7.2.260.0060.01516.46
7.2.250.0070.01416.29
7.2.240.0070.01016.24
7.2.230.0070.00716.62
7.2.220.0070.00716.30
7.2.210.0060.00916.64
7.2.200.0060.00616.71
7.2.190.0090.01216.51
7.2.180.0140.00816.29
7.2.170.0160.00816.67
7.2.160.0060.00916.41
7.2.150.0060.01018.54
7.2.140.0120.00418.24
7.2.130.0120.00318.34
7.2.120.0070.00418.25
7.2.110.0060.01218.32
7.2.100.0110.00618.29
7.2.90.0000.01218.51
7.2.80.0080.00318.39
7.2.70.0080.00818.52
7.2.60.0040.01217.57
7.2.50.0070.01018.30
7.2.40.0060.00618.28
7.2.30.0030.01018.34
7.2.20.0110.00418.47
7.2.10.0120.00318.21
7.2.00.0030.01219.05
7.1.330.0140.00317.33
7.1.320.0060.01017.40
7.1.310.0030.01017.07
7.1.300.0110.00817.30
7.1.290.0120.00917.39
7.1.280.0070.01317.29
7.1.270.0120.00617.36
7.1.260.0100.00717.23
7.1.250.0060.00317.18
7.1.240.0100.00317.36
7.1.230.0120.00617.28
7.1.220.0080.01217.45
7.1.210.0000.01017.27
7.1.200.0060.00816.53
7.1.190.0030.01017.35
7.1.180.0070.00717.41
7.1.170.0100.00617.16
7.1.160.0070.00317.26
7.1.150.0070.00417.18
7.1.140.0070.00317.27
7.1.130.0030.00617.25
7.1.120.0100.00717.42
7.1.110.0060.00617.38
7.1.100.0030.01017.79
7.1.90.0070.01017.39
7.1.80.0060.00617.32
7.1.70.0070.00917.24
7.1.60.0090.00818.19
7.1.50.0070.00917.19
7.1.40.0060.01317.46
7.1.30.0030.00917.31
7.1.20.0070.00717.44
7.1.10.0070.00317.32
7.1.00.0040.04319.82
7.0.330.0000.01417.04
7.0.320.0030.01317.17
7.0.310.0060.00616.85
7.0.300.0030.00916.94
7.0.290.0030.01316.91
7.0.280.0080.00816.93
7.0.270.0030.00716.83
7.0.260.0120.00316.99
7.0.250.0030.00716.80
7.0.240.0030.01016.93
7.0.230.0030.01017.07
7.0.220.0070.00616.98
7.0.210.0080.00817.05
7.0.200.0050.00516.92
7.0.190.0030.00917.07
7.0.180.0090.00617.11
7.0.170.0040.00816.91
7.0.160.0090.00616.98
7.0.150.0030.01016.82
7.0.140.0030.01317.03
7.0.130.0090.00616.90
7.0.120.0000.01416.77
7.0.110.0070.00717.04
7.0.100.0060.00917.02
7.0.90.0070.01116.87
7.0.80.0070.01016.82
7.0.70.0090.00917.03
7.0.60.0080.04019.36
7.0.50.0160.03717.44
7.0.40.0150.03517.62
7.0.30.0230.04417.51
7.0.20.0220.03917.44
7.0.10.0100.04517.39
7.0.00.0100.02717.46
5.6.400.0070.00715.98
5.6.390.0100.00615.86
5.6.380.0100.01015.91
5.6.370.0090.00315.92
5.6.360.0030.00915.90
5.6.350.0030.00615.87
5.6.340.0070.00715.65
5.6.330.0030.01315.79
5.6.320.0060.00615.98
5.6.310.0100.00015.82
5.6.300.0040.01115.54
5.6.290.0000.01015.89
5.6.280.0050.02018.39
5.6.270.0070.00715.98
5.6.260.0070.00715.81
5.6.250.0090.00615.89
5.6.240.0030.01315.98
5.6.230.0060.00615.95
5.6.220.0040.01915.88
5.6.210.0040.03318.15
5.6.200.0050.02416.96
5.6.190.0060.03318.19
5.6.180.0100.02818.19
5.6.170.0200.04418.36
5.6.160.0050.02518.05
5.6.150.0080.02316.98
5.6.140.0020.05016.98
5.6.130.0050.02716.97
5.6.120.0080.04618.34
5.6.110.0060.04318.41
5.6.100.0100.04218.35
5.6.90.0100.03618.46
5.6.80.0100.02917.86
5.6.70.0070.00715.61
5.6.60.0060.00915.89
5.6.50.0040.01215.81
5.6.40.0030.01315.74
5.6.30.0030.01215.69
5.6.20.0060.00615.73
5.6.10.0000.01515.59
5.6.00.0090.00615.73
5.5.380.0040.01115.63
5.5.370.0150.00015.62
5.5.360.0060.01115.63
5.5.350.0070.04218.11
5.5.340.0070.04216.79
5.5.330.0120.03017.96
5.5.320.0160.02118.02
5.5.310.0150.02618.09
5.5.300.0020.02316.88
5.5.290.0090.03516.83
5.5.280.0030.02518.44
5.5.270.0100.03318.28
5.5.260.0180.04118.35
5.5.250.0100.03218.21
5.5.240.0100.04317.89
5.5.230.0100.01115.58
5.5.220.0050.01615.70
5.5.210.0110.01115.58
5.5.200.0070.01515.47
5.5.190.0060.01515.61
5.5.180.0120.00915.66
5.5.170.0000.02315.58
5.5.160.0130.01015.51
5.5.150.0100.01415.71
5.5.140.0110.00715.44
5.5.130.0090.01215.55
5.5.120.0140.00815.68
5.5.110.0210.00015.69
5.5.100.0080.01215.54
5.5.90.0030.01615.46
5.5.80.0150.00515.73
5.5.70.0140.00315.34
5.5.60.0070.01115.55
5.5.50.0060.00915.53
5.5.40.0100.00615.51
5.5.30.0120.00615.55
5.5.20.0070.00415.73
5.5.10.0170.00315.38
5.5.00.0140.00415.58

preferences:
50.28 ms | 400 KiB | 5 Q