3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 'some' => 'somevalue', 'some2'=>'some2value', 'some1' => 'some1value', 'id' => 123 ]; $pattern = [ 'some2', 'id', 'some1', 'some' ]; function sortByTemplate($array, $pattern) { $result = []; foreach (array_flip($pattern) as $k => $v) { if (isset($array[$k])) { $result[$k] = $array[$k]; } } return $result; } print_r(sortByTemplate($array, $pattern));

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.5.90.0040.00516.67
8.5.80.0130.00416.74
8.5.70.0080.00918.41
8.5.60.0120.00616.64
8.5.50.0060.00216.82
8.5.30.0070.01117.57
8.5.20.0110.00619.44
8.5.10.0090.00818.86
8.5.00.0100.01120.14
8.4.240.0130.01019.46
8.4.230.0060.00519.59
8.4.220.0150.00719.61
8.4.210.0150.00721.52
8.4.180.0060.00619.71
8.4.170.0130.00824.06
8.4.160.0130.01023.09
8.4.150.0050.00716.89
8.4.140.0110.01217.63
8.4.130.0060.00617.65
8.4.120.0130.00720.55
8.4.110.0050.00318.61
8.4.100.0130.00217.81
8.4.90.0110.00919.52
8.4.80.0090.01017.54
8.4.70.0110.00917.52
8.4.60.0090.01119.51
8.4.50.0060.00318.80
8.4.40.0100.01017.73
8.4.30.0100.01020.32
8.4.20.0120.00819.65
8.4.10.0050.00319.29
8.3.330.0130.00718.41
8.3.320.0120.00818.56
8.3.310.0140.00520.18
8.3.300.0150.00918.38
8.3.290.0160.00520.75
8.3.280.0110.01318.25
8.3.270.0110.01016.66
8.3.260.0090.01016.46
8.3.250.0050.00419.00
8.3.240.0060.01316.68
8.3.230.0100.01016.73
8.3.220.0070.00917.23
8.3.210.0100.00916.63
8.3.200.0090.01016.53
8.3.190.0110.00916.51
8.3.180.0050.00418.49
8.3.170.0140.00418.93
8.3.160.0080.00020.17
8.3.150.0120.00618.46
8.3.140.0030.00617.23
8.3.130.0070.00718.41
8.3.120.0110.00720.63
8.3.110.0080.00016.62
8.3.100.0080.00016.63
8.3.90.0040.01118.31
8.3.80.0090.00017.97
8.3.70.0110.00416.63
8.3.60.0100.01018.31
8.3.50.0110.00224.34
8.3.40.0030.01220.38
8.3.30.0110.00318.55
8.3.20.0000.00720.77
8.3.10.0040.00420.07
8.3.00.0000.00822.39
8.2.320.0100.00818.07
8.2.310.0130.00818.01
8.2.300.0100.01220.49
8.2.290.0120.00620.24
8.2.280.0030.00718.19
8.2.270.0140.00417.05
8.2.260.0040.00416.40
8.2.250.0070.00017.08
8.2.240.0080.00018.91
8.2.230.0070.01020.94
8.2.220.0080.00024.06
8.2.210.0120.00626.77
8.2.200.0060.00316.63
8.2.190.0100.01016.58
8.2.180.0180.00318.29
8.2.170.0000.01422.96
8.2.160.0130.00719.31
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00319.83
8.2.110.0060.00320.13
8.2.100.0030.01517.91
8.2.90.0070.00018.16
8.2.80.0050.00318.05
8.2.70.0060.00317.50
8.2.60.0040.00417.71
8.2.50.0050.00318.05
8.2.40.0040.00418.21
8.2.30.0050.00319.31
8.2.20.0070.00018.12
8.2.10.0050.00219.40
8.2.00.0000.00719.22
8.1.340.0070.01317.52
8.1.330.0120.00616.56
8.1.320.0100.00916.04
8.1.310.0030.00618.59
8.1.300.0040.00417.86
8.1.290.0060.00318.88
8.1.280.0120.00325.92
8.1.270.0060.00320.82
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00422.24
8.1.230.0040.00720.84
8.1.220.0030.00517.74
8.1.210.0040.00419.04
8.1.200.0000.00917.63
8.1.190.0030.00617.13
8.1.180.0000.00818.10
8.1.170.0030.00517.62
8.1.160.0040.00420.79
8.1.150.0040.00418.84
8.1.140.0000.00718.93
8.1.130.0030.00317.36
8.1.120.0000.00717.39
8.1.110.0030.00517.47
8.1.100.0030.00517.50
8.1.90.0000.00717.50
8.1.80.0040.00817.36
8.1.70.0000.00717.47
8.1.60.0080.00017.55
8.1.50.0000.00817.53
8.1.40.0080.00017.52
8.1.30.0070.00017.61
8.1.20.0040.00417.56
8.1.10.0000.00817.56
8.1.00.0000.00817.49
8.0.300.0000.00719.79
8.0.290.0040.00416.75
8.0.280.0040.00418.45
8.0.270.0030.00318.01
8.0.260.0030.00316.81
8.0.250.0030.00316.86
8.0.240.0030.00316.96
8.0.230.0000.00716.99
8.0.220.0040.00416.78
8.0.210.0030.00316.82
8.0.200.0030.00316.97
8.0.190.0050.00316.91
8.0.180.0050.00316.81
8.0.170.0030.00616.91
8.0.160.0030.00516.92
8.0.150.0000.00716.88
8.0.140.0080.00016.88
8.0.130.0000.00513.34
8.0.120.0000.00816.82
8.0.110.0030.00616.75
8.0.100.0000.00716.71
8.0.90.0060.00316.74
8.0.80.0120.00616.87
8.0.70.0000.00716.84
8.0.60.0040.00416.92
8.0.50.0000.00716.90
8.0.30.0060.01216.88
8.0.20.0080.01217.06
8.0.10.0030.00517.08
8.0.00.0110.00616.53
7.4.330.0000.00515.55
7.4.320.0000.00616.50
7.4.300.0000.00816.51
7.4.290.0070.00016.52
7.4.280.0030.00616.57
7.4.270.0000.00716.51
7.4.260.0000.00513.23
7.4.250.0070.00016.48
7.4.240.0030.00316.55
7.4.230.0030.00316.49
7.4.220.0000.00716.55
7.4.210.0090.00616.56
7.4.200.0000.00716.39
7.4.130.0110.00816.36
7.4.120.0120.00616.50
7.4.110.0130.00416.63
7.4.100.0080.00816.55
7.4.90.0100.00716.41
7.4.80.0160.00619.39
7.4.70.0140.00316.33
7.4.60.0130.00316.47
7.4.50.0000.01716.63
7.4.40.0140.00316.67
7.4.30.0130.00316.51
7.4.20.0060.01016.29
7.4.10.0030.01216.23
7.4.00.0090.00616.33
7.3.330.0040.00416.44
7.3.320.0060.00013.29
7.3.310.0060.00016.39
7.3.300.0000.00716.40
7.3.290.0090.00916.38
7.3.260.0100.00916.54
7.3.230.0100.01016.60
7.3.210.0140.00316.55
7.3.200.0030.02016.33
7.3.190.0030.01316.64
7.3.180.0030.01316.59
7.3.170.0100.00716.28
7.3.160.0170.00016.56
7.3.150.0180.00316.46
7.3.140.0060.00916.39
7.3.130.0120.00316.59
7.3.120.0030.01216.38
7.3.110.0040.01116.60
7.3.100.0090.00616.48
7.3.90.0040.01816.44
7.3.80.0090.00616.44
7.3.70.0000.01416.52
7.3.60.0070.01016.37
7.3.50.0090.00616.41
7.3.40.0090.00916.44
7.3.30.0120.00316.53
7.3.20.0060.00918.20
7.3.10.0080.00818.12
7.3.00.0030.01318.14
7.2.330.0110.01716.68
7.2.320.0110.01016.48
7.2.310.0100.01316.66
7.2.300.0120.00616.66
7.2.290.0090.00616.70
7.2.280.0080.00816.50
7.2.270.0060.00916.72
7.2.260.0080.00816.70
7.2.250.0040.01116.74
7.2.240.0040.01216.71
7.2.230.0070.01016.66
7.2.220.0160.00616.82
7.2.210.0060.00916.57
7.2.200.0090.00616.72
7.2.190.0060.00916.70
7.2.180.0100.00716.63
7.2.170.0150.00916.73
7.2.160.0060.01316.43
7.2.150.0030.01318.57
7.2.140.0040.01218.48
7.2.130.0090.00918.47
7.2.120.0100.00618.30
7.2.110.0060.00918.41
7.2.100.0130.00918.57
7.2.90.0060.01018.51
7.2.80.0160.00018.48
7.2.70.0060.00918.45
7.2.60.0070.00718.55
7.2.50.0040.01518.63
7.2.40.0120.00618.56
7.2.30.0140.00318.52
7.2.20.0120.00618.47
7.2.10.0140.00318.43
7.2.00.0110.00718.36

preferences:
115.53 ms | 1532 KiB | 5 Q