3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ "prefix1 foo", "prefix2 bar", "prefix1 aaa", "prefix2 bbb", "prefix3 ccc", "prefix1 111", "prefix2 222" ]; $prefixes = ['prefix1', 'prefix2', 'prefix3']; $output = array(); $lastidx = count($prefixes); foreach ($input as $item) { list($prefix, $value) = explode(' ', $item); $index = array_search($prefix, $prefixes); if ($index < $lastidx) $output[] = array(); $output[count($output)-1][$prefix] = $value; $lastidx = $index; } print_r($output);

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.70.0100.01018.43
8.3.60.0150.00018.17
8.3.50.0070.01018.19
8.3.40.0110.00418.58
8.3.30.0070.00718.84
8.3.20.0000.00818.95
8.3.10.0050.00223.66
8.3.00.0000.00720.61
8.2.190.0110.00416.58
8.2.180.0070.00718.54
8.2.170.0150.00022.96
8.2.160.0100.00322.16
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0040.00419.83
8.2.120.0040.00426.35
8.2.110.0060.00321.12
8.2.100.0000.01219.64
8.2.90.0000.00919.11
8.2.80.0030.00717.97
8.2.70.0050.00317.63
8.2.60.0020.00717.93
8.2.50.0000.00818.07
8.2.40.0030.00518.34
8.2.30.0000.00918.00
8.2.20.0040.00418.29
8.2.10.0040.00418.00
8.2.00.0050.00317.59
8.1.280.0140.00725.92
8.1.270.0080.00022.16
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0030.00621.05
8.1.230.0070.00422.20
8.1.220.0000.00817.79
8.1.210.0080.00018.77
8.1.200.0050.00517.35
8.1.190.0030.00617.23
8.1.180.0050.00318.10
8.1.170.0040.00718.54
8.1.160.0040.00418.88
8.1.150.0040.00418.80
8.1.140.0030.00322.09
8.1.130.0070.00020.11
8.1.120.0000.00717.46
8.1.110.0000.00717.33
8.1.100.0050.00517.44
8.1.90.0000.00717.49
8.1.80.0040.00417.38
8.1.70.0040.00417.34
8.1.60.0060.00317.56
8.1.50.0000.00817.51
8.1.40.0000.00917.43
8.1.30.0030.00517.66
8.1.20.0000.00717.58
8.1.10.0050.00317.54
8.1.00.0040.00417.48
8.0.300.0060.00318.77
8.0.290.0050.00316.63
8.0.280.0030.00518.39
8.0.270.0070.00017.14
8.0.260.0060.00018.46
8.0.250.0040.00416.97
8.0.240.0070.00017.00
8.0.230.0000.00716.99
8.0.220.0030.00616.80
8.0.210.0040.00416.95
8.0.200.0030.00316.84
8.0.190.0000.00816.97
8.0.180.0080.00016.88
8.0.170.0030.00516.86
8.0.160.0030.00516.99
8.0.150.0070.00016.80
8.0.140.0030.00316.75
8.0.130.0000.00613.38
8.0.120.0040.00416.76
8.0.110.0000.00816.88
8.0.100.0040.00416.93
8.0.90.0040.00416.81
8.0.80.0100.01016.92
8.0.70.0000.00716.69
8.0.60.0070.00016.84
8.0.50.0040.00416.94
8.0.30.0110.00817.09
8.0.20.0170.00317.40
8.0.10.0000.00817.04
8.0.00.0100.00716.64
7.4.330.0060.00015.55
7.4.320.0060.00016.45
7.4.300.0030.00316.48
7.4.290.0060.00316.62
7.4.280.0000.00816.45
7.4.270.0070.00016.59
7.4.260.0040.00416.63
7.4.250.0030.00316.39
7.4.240.0040.00416.52
7.4.230.0000.00716.65
7.4.220.0030.00616.59
7.4.210.0080.00716.56
7.4.200.0030.00316.67
7.4.160.0090.00916.53
7.4.140.0100.00917.86
7.4.130.0130.00416.64
7.4.120.0110.00716.48
7.4.110.0100.01016.55
7.4.100.0080.01516.63
7.4.90.0060.01216.59
7.4.80.0000.02019.39
7.4.70.0080.01216.39
7.4.60.0030.01316.45
7.4.50.0030.01216.45
7.4.40.0070.00916.32
7.4.00.0060.00914.73
7.3.330.0020.00213.20
7.3.320.0000.00613.17
7.3.310.0030.00616.32
7.3.300.0070.00016.28
7.3.290.0040.00416.24
7.3.280.0070.00816.39
7.3.260.0090.00816.47
7.3.240.0090.00816.47
7.3.230.0110.00616.60
7.3.210.0030.01316.38
7.3.200.0120.00916.58
7.3.190.0180.00616.39
7.3.180.0120.00316.51
7.3.170.0000.01716.38
7.3.160.0090.00716.57
7.3.120.0120.00314.93
7.3.110.0160.00014.74
7.3.100.0070.01114.97
7.3.90.0000.01014.63
7.3.80.0000.00914.56
7.3.70.0070.00714.75
7.3.60.0120.00314.75
7.3.50.0090.00914.89
7.3.40.0090.00614.62
7.3.30.0070.01014.88
7.3.20.0090.00016.72
7.3.10.0040.00816.69
7.3.00.0050.00316.69
7.2.330.0130.00316.45
7.2.320.0120.01216.77
7.2.310.0100.01316.48
7.2.300.0120.00416.57
7.2.290.0040.01416.78
7.2.250.0000.01814.91
7.2.240.0060.01315.02
7.2.230.0090.00614.89
7.2.220.0060.00814.98
7.2.210.0100.00315.08
7.2.200.0100.00715.08
7.2.190.0090.00615.09
7.2.180.0040.00915.14
7.2.170.0060.00914.78
7.2.160.0090.00615.03
7.2.150.0040.00817.03
7.2.140.0060.00317.04
7.2.130.0060.00317.00
7.2.120.0090.00016.89
7.2.110.0320.00615.84
7.2.100.0400.00615.93
7.2.90.0450.01115.80
7.2.80.0250.01116.03
7.2.70.0320.00815.82
7.2.60.0350.00915.96
7.2.50.0430.00616.12
7.2.40.0290.01115.95
7.2.30.0340.00516.04
7.2.20.0370.01216.04
7.2.10.0340.00515.85
7.2.00.0340.00715.74
7.1.330.0070.00715.75
7.1.320.0070.01015.82
7.1.310.0030.01315.94
7.1.300.0090.00915.88
7.1.290.0030.00615.71
7.1.280.0030.01015.63
7.1.270.0070.01015.59
7.1.260.0030.00715.98
7.1.250.0060.00316.02
7.1.230.0560.01013.92
7.1.220.0440.00713.50
7.1.210.0510.00714.00
7.1.200.0700.01013.91
7.1.190.0680.00713.86
7.1.180.0420.00614.14
7.1.170.0750.01313.66
7.1.160.0950.00714.10
7.1.150.1380.00314.16
7.1.140.0590.00914.07
7.1.130.0610.01313.64
7.1.120.0710.00714.00
7.1.110.0630.00314.13
7.1.100.0690.00313.78
7.1.90.0740.00313.90
7.1.80.1250.01013.97
7.1.70.1270.01314.10
7.1.60.1230.01032.04
7.1.50.1370.02131.93
7.1.40.1250.01331.87
7.1.30.1390.00331.66
7.1.20.3120.00031.72
7.1.10.2370.00713.98
7.1.00.1710.00613.99
5.6.380.0180.00014.08

preferences:
35.04 ms | 401 KiB | 5 Q