3v4l.org

run code in 300+ PHP versions simultaneously
<?php $utterance = 'This is a brown bear with 7 kids'; $template = 'This is a {color} bear with {kids} kids'; $newPattern = '/'; foreach(preg_split('/(\{.*?\})/', $template, -1, PREG_SPLIT_DELIM_CAPTURE) as $part) { if(preg_match('/^(\{.*\})$/', $part)) { $varName = trim($part, '{}'); $newPattern .= '(?P<'. preg_quote($varName) . '>.+)'; } else { $newPattern .= preg_quote($part); } } $newPattern .= '/'; echo $newPattern; echo "\n"; preg_match($newPattern, $utterance, $variables); var_dump($variables);

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.4.130.0140.00818.02
8.4.120.0130.00720.51
8.4.110.0120.00822.13
8.4.100.0120.00817.88
8.4.90.0100.01118.67
8.4.80.0120.00819.75
8.4.70.0110.01118.10
8.4.60.0090.01119.01
8.4.50.0120.00818.68
8.4.40.0140.00718.03
8.4.30.0100.01019.03
8.4.20.0000.01917.89
8.4.10.0100.01022.19
8.3.250.0100.01218.83
8.3.240.0080.01316.75
8.3.230.0070.01016.69
8.3.220.0070.00119.32
8.3.210.0110.00316.70
8.3.200.0040.00517.00
8.3.190.0100.00519.21
8.3.180.0100.01016.76
8.3.170.0080.00820.63
8.3.160.0160.00317.38
8.3.150.0180.00019.09
8.3.140.0110.00816.81
8.3.130.0030.00616.82
8.3.120.0120.00620.58
8.3.110.0080.00016.84
8.3.100.0030.00718.52
8.3.90.0070.00326.77
8.3.80.0060.00318.43
8.3.70.0040.01816.75
8.3.60.0090.00616.63
8.3.50.0130.00720.34
8.3.40.0100.01020.45
8.3.30.0110.00418.76
8.3.20.0040.00424.18
8.3.10.0100.00024.66
8.3.00.0050.00326.16
8.2.290.0120.00720.37
8.2.280.0060.00918.16
8.2.270.0100.01017.27
8.2.260.0060.01218.57
8.2.250.0050.00316.71
8.2.240.0130.00716.75
8.2.230.0080.00020.94
8.2.220.0050.00324.06
8.2.210.0080.00026.77
8.2.200.0040.00418.54
8.2.190.0090.00616.58
8.2.180.0070.01525.92
8.2.170.0040.01219.13
8.2.160.0080.00622.96
8.2.150.0040.00425.66
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0040.00426.16
8.2.110.0070.00419.31
8.2.100.0080.00418.03
8.2.90.0030.00517.88
8.2.80.0080.00018.91
8.2.70.0040.00417.88
8.2.60.0000.00817.75
8.2.50.0000.00818.03
8.2.40.0040.00418.16
8.2.30.0080.00018.27
8.2.20.0040.00419.29
8.2.10.0040.00418.07
8.2.00.0040.00419.25
8.1.330.0080.01222.07
8.1.320.0140.00716.39
8.1.310.0050.00318.56
8.1.300.0070.00716.54
8.1.290.0040.00430.84
8.1.280.0090.00925.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00719.38
8.1.230.0090.00320.96
8.1.220.0050.00318.73
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0000.00919.14
8.1.170.0000.00817.62
8.1.160.0040.00419.05
8.1.150.0060.00618.70
8.1.140.0000.00817.63
8.1.130.0000.00918.82
8.1.120.0000.00717.51
8.1.110.0040.00417.61
8.1.100.0070.01117.52
8.1.90.0110.00517.52
8.1.80.0110.00617.59
8.1.70.0100.00617.58
8.1.60.0160.00317.61
8.1.50.0140.00417.64
8.1.40.0090.00917.65
8.1.30.0150.00417.76
8.1.20.0140.00417.78
8.1.10.0040.01317.63
8.1.00.0140.00617.59
8.0.300.0050.00318.77
8.0.290.0030.00616.88
8.0.280.0070.00018.52
8.0.270.0050.00316.96
8.0.260.0040.00418.45
8.0.250.0030.00316.99
8.0.240.0050.00217.11
8.0.230.0140.00417.01
8.0.220.0090.00816.88
8.0.210.0150.00017.01
8.0.200.0080.00717.06
8.0.190.0070.00917.10
8.0.180.0100.00516.99
8.0.170.0120.00216.90
8.0.160.0040.01117.02
8.0.150.0120.00316.88
8.0.140.0060.00916.86
8.0.130.0110.00516.95
8.0.120.0060.01016.94
8.0.110.0100.00417.01
8.0.100.0140.00116.88
8.0.90.0090.00716.99
8.0.80.0120.00317.00
8.0.70.0070.00716.89
8.0.60.0100.00516.99
8.0.50.0060.00917.03
8.0.30.0130.00317.00
8.0.20.0110.00416.94
8.0.10.0140.00117.03
7.4.330.0040.00415.55
7.4.320.0060.00016.61
7.4.300.0090.00716.72
7.4.290.0110.00316.76
7.4.280.0030.01016.62
7.4.270.0120.00416.76
7.4.260.0110.00416.74
7.4.250.0040.00716.73
7.4.240.0070.00516.50
7.4.230.0030.00616.68
7.4.220.0090.00116.38
7.4.210.0040.00716.47
7.4.200.0060.00316.68
7.4.190.0050.00516.59
7.4.180.0050.00516.68
7.4.160.0020.00616.54
7.4.150.0060.00316.47
7.4.140.0090.00216.61
7.4.130.0090.00316.40
7.4.120.0050.00616.47
7.4.110.0070.00416.49
7.4.100.0020.01016.68
7.4.90.0100.00116.76
7.4.80.0060.00616.26
7.4.70.0080.00416.58
7.4.60.0060.00616.40
7.4.50.0050.00516.08
7.4.40.0060.00616.42
7.4.30.0070.00516.23
7.4.20.0100.00216.23
7.4.10.0050.00416.44
7.4.00.0030.00616.10

preferences:
16.75 ms | 403 KiB | 5 Q