3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "cat:others;id:4,9,13", "id:4,9,13;cat:electric-products", "id:4,9,13;cat:foods", "cat:drinks,foods" ]; $count = preg_match_all( '/(?:^|;)(id|cat):|\G(?!^),?([^,;]+)/', implode(';', $strings), $matches, PREG_UNMATCHED_AS_NULL ); $cat = []; $id = []; for ($i = 0; $i < $count; ++$i) { if ($matches[1][$i] !== null) { $arrayName = $matches[1][$i]; } else { ${$arrayName}[$matches[2][$i]] = $matches[2][$i]; } } var_export(array_values($id)); echo "\n---\n"; var_export(array_values($cat));

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.10.0090.00918.56
8.5.00.0140.00820.24
8.4.160.0110.01023.81
8.4.150.0030.00014.05
8.4.140.0130.00818.04
8.4.130.0170.00418.66
8.4.120.0130.00817.86
8.4.110.0050.00422.43
8.4.100.0120.00917.96
8.4.90.0110.00820.81
8.4.80.0070.01218.94
8.4.70.0130.00918.30
8.4.60.0130.00720.08
8.4.50.0120.00720.54
8.4.40.0070.01019.51
8.4.30.0100.01018.45
8.4.20.0130.01018.73
8.4.10.0040.00417.82
8.3.280.0100.01118.68
8.3.270.0150.00716.34
8.3.260.0130.00716.71
8.3.250.0150.00618.43
8.3.240.0080.01116.51
8.3.230.0110.00816.73
8.3.220.0070.00519.14
8.3.210.0070.00816.80
8.3.200.0120.00716.64
8.3.190.0110.00717.09
8.3.180.0130.00619.14
8.3.170.0120.00618.97
8.3.160.0030.01417.18
8.3.150.0180.00016.86
8.3.140.0100.00318.94
8.3.130.0030.01116.68
8.3.120.0090.00020.71
8.3.110.0070.00720.94
8.3.100.0050.00524.06
8.3.90.0100.00726.77
8.3.80.0060.00319.36
8.3.70.0110.01118.52
8.3.60.0130.01016.75
8.3.50.0140.00718.32
8.3.40.0040.01118.95
8.3.30.0040.01219.09
8.3.20.0070.01124.18
8.3.10.0130.00624.66
8.3.00.0110.00726.16
8.2.290.0130.00520.64
8.2.280.0030.00716.73
8.2.270.0110.00416.86
8.2.260.0090.00916.85
8.2.250.0040.00418.60
8.2.240.0110.00717.29
8.2.230.0100.00722.58
8.2.220.0090.00037.54
8.2.210.0080.00026.77
8.2.200.0000.00918.88
8.2.190.0180.00417.00
8.2.180.0160.00625.92
8.2.170.0110.00419.07
8.2.160.0040.01122.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0070.01026.16
8.2.120.0070.00318.04
8.2.110.0070.00322.23
8.2.100.0090.00318.03
8.2.90.0030.00618.22
8.2.80.0000.00819.04
8.2.70.0030.00617.63
8.2.60.0030.00617.93
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0040.00418.21
8.2.20.0040.00418.05
8.2.10.0000.00919.20
8.2.00.0070.00019.38
8.1.330.0140.00621.81
8.1.320.0100.00916.30
8.1.310.0060.00916.38
8.1.300.0080.00820.16
8.1.290.0090.00030.84
8.1.280.0030.01725.92
8.1.270.0070.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.91
8.1.230.0040.00719.10
8.1.220.0000.00817.77
8.1.210.0040.00418.77
8.1.200.0060.00317.61
8.1.190.0030.00517.48
8.1.180.0040.00418.10
8.1.170.0030.00518.64
8.1.160.0040.00419.02
8.1.150.0080.00018.79
8.1.140.0000.00718.83
8.1.130.0070.00020.04
8.1.120.0050.00317.45
8.1.110.0030.00717.59
8.1.100.0030.00617.56
8.1.90.0070.00017.49
8.1.80.0040.00417.59
8.1.70.0000.00817.57
8.1.60.0030.00517.71
8.1.50.0030.00917.50
8.1.40.0040.00417.56
8.1.30.0000.00817.80
8.1.20.0070.00317.75
8.1.10.0000.00817.63
8.1.00.0030.00717.55
8.0.300.0040.00418.77
8.0.290.0000.00816.88
8.0.280.0030.00318.38
8.0.270.0000.00818.13
8.0.260.0030.00318.40
8.0.250.0040.00417.09
8.0.240.0050.00317.09
8.0.230.0000.00717.08
8.0.220.0040.00417.07
8.0.210.0030.00517.03
8.0.200.0060.00017.06
8.0.190.0040.00417.06
8.0.180.0050.00317.05
8.0.170.0030.00516.97
8.0.160.0000.00717.05
8.0.150.0040.00416.96
8.0.140.0040.00417.01
8.0.130.0050.00013.45
8.0.120.0000.00817.05
8.0.110.0040.00417.08
8.0.100.0050.00216.90
8.0.90.0000.00717.10
8.0.80.0090.00916.97
8.0.70.0040.00417.06
8.0.60.0040.00417.09
8.0.50.0040.00416.90
8.0.30.0260.01117.00
8.0.20.0240.00817.02
8.0.10.0250.00817.10
8.0.00.0170.01517.23
7.4.330.0050.00015.55
7.4.320.0000.00616.71
7.4.300.0060.00016.81
7.4.290.0050.00316.57
7.4.280.0000.00716.75
7.4.270.0000.00816.57
7.4.260.0030.00313.43
7.4.250.0030.00316.75
7.4.240.0060.00116.81
7.4.230.0040.00416.79
7.4.220.0020.00516.65
7.4.210.0030.01116.66
7.4.200.0030.00316.57
7.4.160.0240.00716.83
7.4.150.0270.00416.98
7.4.140.0280.00916.76
7.4.130.0230.01216.63
7.4.120.0230.01116.67
7.4.110.0270.00716.64
7.4.100.0260.00816.75
7.4.90.0230.01016.89
7.4.80.0210.00716.61
7.4.70.0250.01316.66
7.4.60.0240.01016.71
7.4.50.0240.00616.55
7.4.40.0260.00316.70
7.4.30.0190.01416.83
7.4.20.0250.00816.73
7.4.10.0220.01116.70
7.4.00.0210.01016.63
7.3.330.0000.00716.48
7.3.320.0000.00613.30
7.3.310.0030.00316.57
7.3.300.0000.00716.48
7.3.290.0070.01216.54
7.3.280.0130.00516.52
7.3.270.0240.01016.57
7.3.260.0280.00816.42
7.3.250.0210.00816.50
7.3.240.0210.01116.49
7.3.230.0300.00316.46
7.3.220.0310.00516.41
7.3.210.0250.01116.46
7.3.200.0290.00416.51
7.3.190.0180.01516.50
7.3.180.0180.01116.43
7.3.170.0210.01516.40
7.3.160.0260.00816.46
7.3.150.0240.01016.40
7.3.140.0150.01916.43
7.3.130.0380.01716.36
7.3.120.0220.01216.36
7.3.110.0160.01616.45
7.3.100.0280.00616.33
7.3.90.0160.01716.75
7.3.80.0330.01016.45
7.3.70.0240.01116.54
7.3.60.0310.00016.56
7.3.50.0300.01416.53
7.3.40.0200.01416.54
7.3.30.0230.00416.54
7.3.20.0210.00816.62
7.3.10.0200.00816.54
7.3.00.0290.00416.61

preferences:
36.62 ms | 403 KiB | 5 Q