3v4l.org

run code in 300+ PHP versions simultaneously
<?php function extractRouteParameterComponents($routeParameter) { $regexPattern = "/^{(\w+)(?::(.+))?}(\?)?$/"; if (preg_match($regexPattern, $routeParameter, $matches)) { $name = $matches[1]; $type = $matches[2] ?? "[^/]"; $optional = isset($matches[3]); return [$name, $type, $optional]; } } $routeParameter = "{id:[0-9]+}?"; $parameterComponents = extractRouteParameterComponents($route); var_dump($parameterComponents);

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.0120.00316.88
8.3.50.0120.01021.28
8.3.40.0110.00418.75
8.3.30.0140.00018.83
8.3.20.0000.00820.34
8.3.10.0040.00421.73
8.3.00.0080.00023.58
8.2.180.0060.00916.88
8.2.170.0120.00322.96
8.2.160.0150.00020.34
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00019.66
8.2.120.0000.00826.35
8.2.110.0060.00322.38
8.2.100.0030.00917.80
8.2.90.0000.00819.04
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0050.00217.91
8.2.50.0050.00818.07
8.2.40.0040.00422.40
8.2.30.0000.00719.33
8.2.20.0060.00317.77
8.2.10.0080.00018.09
8.2.00.0040.00418.15
8.1.280.0080.00825.92
8.1.270.0090.00923.84
8.1.260.0040.00428.09
8.1.250.0000.00928.09
8.1.240.0000.00923.97
8.1.230.0070.00319.00
8.1.220.0030.00517.74
8.1.210.0030.00718.77
8.1.200.0000.00917.47
8.1.190.0040.00417.25
8.1.180.0030.00618.10
8.1.170.0080.00018.64
8.1.160.0070.00020.69
8.1.150.0000.00918.77
8.1.140.0080.00019.60
8.1.130.0000.00717.73
8.1.120.0040.00417.55
8.1.110.0000.00717.45
8.1.100.0040.00417.45
8.1.90.0000.00817.57
8.1.80.0070.00017.52
8.1.70.0000.00717.57
8.1.60.0040.00417.63
8.1.50.0000.00817.73
8.1.40.0040.00417.74
8.1.30.0040.00417.85
8.1.20.0080.00017.66
8.1.10.0080.00017.69
8.1.00.0000.00717.50
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.34
8.0.270.0090.00017.17
8.0.260.0000.00817.23
8.0.250.0000.00717.03
8.0.240.0000.00817.14
8.0.230.0000.00717.02
8.0.220.0030.00716.96
8.0.210.0000.00717.07
8.0.200.0030.00617.13
8.0.190.0030.00517.11
8.0.180.0030.00517.02
8.0.170.0000.00717.05
8.0.160.0080.00017.07
8.0.150.0000.00716.98
8.0.140.0070.00217.01
8.0.130.0000.00513.56
8.0.120.0000.00817.05
8.0.110.0020.00517.08
8.0.100.0040.00417.14
8.0.90.0030.00517.07
8.0.80.0130.00717.02
8.0.70.0040.00417.05
8.0.60.0050.00317.12
8.0.50.0070.00017.06
8.0.30.0090.01117.17
8.0.20.0110.00917.40
8.0.10.0070.00017.02
8.0.00.0090.01016.99
7.4.330.0000.00516.73
7.4.320.0030.00316.76
7.4.300.0040.00416.77
7.4.290.0070.00016.72
7.4.280.0030.00616.72
7.4.270.0000.00716.66
7.4.260.0030.00516.80
7.4.250.0050.00316.71
7.4.240.0020.00616.85
7.4.230.0000.00716.54
7.4.220.0040.01116.82
7.4.210.0060.00916.85
7.4.200.0030.00316.71
7.4.160.0110.00416.64
7.4.150.0110.00617.40
7.4.140.0120.00617.86
7.4.130.0060.01216.73
7.4.120.0140.01016.65
7.4.110.0030.02116.85
7.4.100.0100.01316.65
7.4.90.0030.01416.43
7.4.80.0070.01619.39
7.4.70.0030.01316.75
7.4.60.0090.00616.66
7.4.50.0100.00616.70
7.4.40.0060.01116.64
7.4.30.0030.01416.61
7.4.00.0000.01315.39
7.3.330.0030.00313.32
7.3.320.0030.00313.37
7.3.310.0030.00316.53
7.3.300.0040.00416.42
7.3.290.0100.00616.49
7.3.280.0080.00916.46
7.3.270.0140.00417.40
7.3.260.0060.01616.70
7.3.250.0120.00716.53
7.3.240.0090.00816.53
7.3.230.0070.01116.43
7.3.210.0120.00916.39
7.3.200.0040.01216.64
7.3.190.0090.00916.66
7.3.180.0130.00316.80
7.3.170.0160.00016.66
7.3.160.0070.01016.49
7.2.330.0170.00016.79
7.2.320.0160.00316.57
7.2.310.0100.01316.80
7.2.300.0090.01516.64
7.2.290.0070.01016.54
7.2.60.0030.01316.80
7.2.00.0070.00319.72
7.1.200.0030.01015.82
7.1.100.0060.00618.47
7.1.70.0000.01017.36
7.1.60.0140.01019.30
7.1.50.0000.01117.10
7.1.00.0000.08022.47
7.0.200.0000.00716.77
7.0.60.0300.07319.95
7.0.50.0100.07017.90
7.0.40.0070.06020.26
7.0.30.0270.04720.23
7.0.20.0330.08020.35
7.0.10.0030.05720.09
7.0.00.0100.08720.07
5.6.280.0070.06021.13
5.6.210.0130.07720.67
5.6.200.0070.05318.18
5.6.190.0130.04020.64
5.6.180.0500.06720.61
5.6.170.0300.07320.45
5.6.160.0070.08320.57
5.6.150.0070.07318.29
5.6.140.0070.07318.16
5.6.130.0100.04318.29
5.6.120.0100.08721.01
5.6.110.0070.04021.00
5.6.100.0170.07720.96
5.6.90.0030.07020.93
5.6.80.0100.08020.48
5.5.350.0170.08020.45
5.5.340.0030.04318.09
5.5.330.0130.07720.42
5.5.320.0300.05320.38
5.5.310.0130.04720.37
5.5.300.0100.07718.06
5.5.290.0130.07718.00
5.5.280.0170.07720.85
5.5.270.0070.05320.87
5.5.260.0070.04020.88
5.5.250.0270.06720.59
5.5.240.0030.08320.26

preferences:
55.27 ms | 401 KiB | 5 Q