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}?"; $parameterComponents = extractRouteParameterComponents($routeParameter); 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.75
8.3.50.0140.00621.16
8.3.40.0070.00718.96
8.3.30.0070.00718.96
8.3.20.0050.00320.11
8.3.10.0040.00421.71
8.3.00.0080.00023.66
8.2.180.0070.01418.54
8.2.170.0090.00622.96
8.2.160.0030.01020.57
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0060.00319.89
8.2.120.0080.00026.35
8.2.110.0060.00322.20
8.2.100.0040.00817.93
8.2.90.0040.00419.22
8.2.80.0050.00317.97
8.2.70.0060.00317.75
8.2.60.0040.00418.03
8.2.50.0050.00518.07
8.2.40.0050.00322.15
8.2.30.0080.00019.54
8.2.20.0060.00317.79
8.2.10.0080.00018.19
8.2.00.0050.00318.04
8.1.280.0110.00725.92
8.1.270.0070.01423.87
8.1.260.0040.00428.09
8.1.250.0030.00628.09
8.1.240.0030.00723.83
8.1.230.0120.00019.17
8.1.220.0060.00317.74
8.1.210.0000.00918.77
8.1.200.0040.00417.36
8.1.190.0000.00817.48
8.1.180.0030.00518.10
8.1.170.0000.00818.68
8.1.160.0040.00420.77
8.1.150.0040.00418.92
8.1.140.0000.00819.60
8.1.130.0000.00717.80
8.1.120.0040.00317.66
8.1.110.0030.00517.62
8.1.100.0000.00817.46
8.1.90.0050.00217.65
8.1.80.0040.00417.54
8.1.70.0040.00417.48
8.1.60.0000.00817.63
8.1.50.0050.00317.66
8.1.40.0040.00417.71
8.1.30.0080.00017.68
8.1.20.0040.00417.71
8.1.10.0040.00417.71
8.1.00.0040.00417.64
8.0.300.0040.00418.77
8.0.290.0050.00216.85
8.0.280.0030.00318.46
8.0.270.0090.00017.23
8.0.260.0030.00317.20
8.0.250.0060.00017.18
8.0.240.0030.00317.02
8.0.230.0000.00817.17
8.0.220.0040.00417.09
8.0.210.0000.00716.98
8.0.200.0100.00017.13
8.0.190.0000.00817.11
8.0.180.0070.00017.12
8.0.170.0070.00017.10
8.0.160.0000.00717.13
8.0.150.0000.00817.12
8.0.140.0050.00517.04
8.0.130.0030.00313.50
8.0.120.0080.00017.00
8.0.110.0050.00317.02
8.0.100.0020.00517.00
8.0.90.0040.00417.08
8.0.80.0140.00717.03
8.0.70.0000.00817.09
8.0.60.0030.00516.86
8.0.50.0040.00317.03
8.0.30.0110.00717.42
8.0.20.0110.00717.40
8.0.10.0070.00017.00
8.0.00.0100.00817.10
7.4.330.0030.00316.79
7.4.320.0030.00316.73
7.4.300.0020.00516.82
7.4.290.0080.00016.73
7.4.280.0030.00716.86
7.4.270.0070.00016.73
7.4.260.0050.00316.71
7.4.250.0040.00416.60
7.4.240.0020.00516.86
7.4.230.0040.00416.71
7.4.220.0070.01116.79
7.4.210.0110.00416.78
7.4.200.0000.00716.55
7.4.160.0000.01716.90
7.4.150.0090.00917.40
7.4.140.0080.01117.86
7.4.130.0130.00616.79
7.4.120.0110.00716.75
7.4.110.0040.01416.49
7.4.100.0160.00916.85
7.4.90.0070.01716.61
7.4.80.0160.00619.39
7.4.70.0000.02516.65
7.4.60.0090.00616.58
7.4.50.0000.01716.59
7.4.40.0130.00316.64
7.4.30.0070.01116.75
7.4.10.0030.01716.50
7.4.00.0060.01115.61
7.3.330.0000.00613.35
7.3.320.0070.00013.54
7.3.310.0000.00716.36
7.3.300.0070.00016.55
7.3.290.0040.01116.52
7.3.280.0070.00916.50
7.3.270.0110.00617.40
7.3.260.0070.01016.49
7.3.250.0110.00916.48
7.3.240.0100.00916.74
7.3.230.0090.00916.54
7.3.210.0060.01016.45
7.3.200.0090.00619.39
7.3.190.0040.01316.40
7.3.180.0090.00916.60
7.3.170.0030.01316.47
7.3.160.0080.00816.74
7.3.130.0100.01016.34
7.3.120.0040.01215.80
7.3.110.0100.00715.84
7.3.100.0100.00515.84
7.3.90.0060.00915.85
7.3.80.0030.01116.01
7.3.70.0040.01115.75
7.3.60.0050.00615.82
7.3.50.0100.00615.68
7.3.40.0050.01215.72
7.3.30.0110.00415.71
7.3.20.0040.01117.70
7.3.10.0080.00817.58
7.3.00.0060.00517.49
7.2.330.0090.00916.74
7.2.320.0100.00716.89
7.2.310.0180.00416.88
7.2.300.0120.01016.98
7.2.290.0120.00916.75
7.2.260.0070.01416.71
7.2.250.0100.00816.04
7.2.240.0100.01015.89
7.2.230.0020.01616.04
7.2.220.0050.01116.07
7.2.210.0080.00516.03
7.2.200.0070.00815.90
7.2.190.0050.00715.99
7.2.180.0060.01115.85
7.2.170.0080.00716.01
7.2.160.0000.02016.74
7.2.150.0000.01718.55
7.2.140.0030.01318.58
7.2.130.0070.00718.57
7.2.120.0110.00818.50
7.2.110.0070.01018.49
7.2.100.0100.01018.53
7.2.90.0040.00818.69
7.2.80.0090.00618.57
7.2.70.0110.01418.76
7.2.60.0100.00817.96
7.2.50.0100.00718.74
7.2.40.0030.01018.59
7.2.30.0100.00618.54
7.2.20.0040.01118.57
7.2.10.0100.00318.56
7.2.00.0040.00919.18
7.1.330.0050.00916.74
7.1.320.0090.00616.73
7.1.310.0060.00816.68
7.1.300.0040.00916.66
7.1.290.0040.00916.79
7.1.280.0050.01016.88
7.1.270.0000.01616.71
7.1.260.0080.00316.79
7.1.250.0090.00617.60
7.1.240.0100.01017.65
7.1.230.0070.01017.40
7.1.220.0090.00617.54
7.1.210.0080.00817.45
7.1.200.0050.01116.86
7.1.190.0000.01417.62
7.1.180.0170.00317.49
7.1.170.0100.00517.27
7.1.160.0100.00317.52
7.1.150.0040.01517.55
7.1.140.0000.01117.57
7.1.130.0080.00617.61
7.1.120.0030.00617.40
7.1.110.0120.00317.59
7.1.100.0030.00817.93
7.1.90.0030.01017.51
7.1.80.0030.01317.62
7.1.70.0020.01217.44
7.1.60.0100.01018.47
7.1.50.0080.00817.36
7.1.40.0040.01817.50
7.1.30.0030.01117.54
7.1.20.0030.01117.51
7.1.10.0060.00917.59
7.1.00.0030.04519.87
7.0.330.0040.00716.94
7.0.320.0070.00717.13
7.0.310.0100.00317.14
7.0.300.0060.01217.27
7.0.290.0060.00617.25
7.0.280.0060.00317.23
7.0.270.0030.00717.23
7.0.260.0100.00717.26
7.0.250.0090.00317.30
7.0.240.0000.00917.38
7.0.230.0110.00017.14
7.0.220.0090.00617.30
7.0.210.0030.00616.96
7.0.200.0050.00417.07
7.0.190.0070.01317.41
7.0.180.0090.00317.20
7.0.170.0060.00617.30
7.0.160.0110.00017.15
7.0.150.0090.00616.84
7.0.140.0070.00417.04
7.0.130.0040.01217.06
7.0.120.0110.00717.16
7.0.110.0040.00717.11
7.0.100.0060.01017.00
7.0.90.0030.01017.16
7.0.80.0070.00717.03
7.0.70.0030.00617.09
7.0.60.0160.04118.64
7.0.50.0030.04917.46
7.0.40.0030.03917.74
7.0.30.0230.04017.59
7.0.20.0180.04317.59
7.0.10.0050.02717.59
7.0.00.0030.02717.68
5.6.400.0090.00615.46
5.6.390.0070.00715.93
5.6.380.0030.00715.71
5.6.370.0020.01315.73
5.6.360.0120.00315.84
5.6.350.0110.00715.60
5.6.340.0070.00715.72
5.6.330.0070.00315.70
5.6.320.0070.00715.63
5.6.310.0090.00615.41
5.6.300.0030.01215.68
5.6.290.0090.00615.52
5.6.280.0060.03418.18
5.6.270.0080.00815.79
5.6.260.0100.00615.42
5.6.250.0070.00715.58
5.6.240.0030.00615.88
5.6.230.0000.01415.56
5.6.220.0030.01515.72
5.6.210.0040.03817.93
5.6.200.0070.04316.85
5.6.190.0080.04217.93
5.6.180.0290.02418.24
5.6.170.0270.02618.10
5.6.160.0000.03018.11
5.6.150.0020.02817.05
5.6.140.0070.04016.83
5.6.130.0080.02216.94
5.6.120.0070.03018.29
5.6.110.0050.02218.38
5.6.100.0050.03718.35
5.6.90.0050.03918.21
5.6.80.0080.04117.99
5.6.70.0070.00715.74
5.6.60.0030.00715.47
5.6.50.0060.00615.61
5.6.40.0030.01315.66
5.6.30.0080.00415.59
5.6.20.0110.00415.70
5.6.10.0070.00715.48
5.6.00.0000.00915.65
5.5.380.0060.00615.34
5.5.370.0000.01015.76
5.5.360.0060.00615.56
5.5.350.0120.05018.09
5.5.340.0020.03216.90
5.5.330.0130.04117.97
5.5.320.0160.03317.96
5.5.310.0150.03818.02
5.5.300.0090.04216.86
5.5.290.0030.02716.81
5.5.280.0070.02318.15
5.5.270.0110.03618.17
5.5.260.0040.02218.08
5.5.250.0100.04518.10
5.5.240.0100.03617.85
5.5.230.0060.00915.57
5.5.220.0090.00015.50
5.5.210.0060.00815.53
5.5.200.0100.00315.57
5.5.190.0030.01215.62
5.5.180.0110.00315.59
5.5.170.0040.00915.39
5.5.160.0000.01415.55
5.5.150.0040.01115.67
5.5.140.0040.01115.52
5.5.130.0090.00315.30
5.5.120.0060.00815.57
5.5.110.0030.01015.38
5.5.100.0080.00615.57
5.5.90.0060.00915.54
5.5.80.0100.00015.76
5.5.70.0040.00415.50
5.5.60.0050.00515.58
5.5.50.0070.00415.25
5.5.40.0000.01515.47
5.5.30.0060.01115.60
5.5.20.0070.00715.56
5.5.10.0030.00815.54
5.5.00.0110.00015.50

preferences:
61.1 ms | 401 KiB | 5 Q