3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pathInfo = 'store/view/14342/galaxy-s10-lite-sm-g770-8gb'; $routes = [ 'store/{id}/{pid}' => ['home/store', ['id', 'exuo', 'pid']], 'store/{id}' => ['home/store', ['id']], 'store/view/{id}/{name}' => ['home/store', ['id', 'name']], // pathInfo should match this route ]; function findRoute(array $routes, string $pathInfo): ?string { foreach (array_keys($routes) as $routePath) { $pattern = '~^' . preg_replace('/{.*?}/', '[^/]+', $routePath) . '$~'; if (preg_match($pattern, $pathInfo)) { return $routePath; } } return null; } echo findRoute($routes, $pathInfo);

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.120.0110.00720.48
8.4.110.0070.01018.89
8.4.100.0090.01218.14
8.4.90.0100.01122.25
8.4.80.0110.00819.15
8.4.70.0140.00917.94
8.4.60.0120.00718.82
8.4.50.0060.00618.62
8.4.40.0090.00018.09
8.4.30.0080.00020.45
8.4.20.0090.00917.82
8.4.10.0130.00719.66
8.3.250.0110.00418.64
8.3.240.0120.00616.87
8.3.230.0130.00716.75
8.3.220.0090.00619.06
8.3.210.0090.00418.35
8.3.200.0050.00516.56
8.3.190.0040.00317.13
8.3.180.0080.00719.01
8.3.170.0120.00620.67
8.3.160.0110.00816.96
8.3.150.0120.00617.16
8.3.140.0080.01216.63
8.3.130.0100.00716.67
8.3.120.0060.00320.63
8.3.110.0070.00016.72
8.3.100.0000.00924.06
8.3.90.0030.00526.77
8.3.80.0060.00616.63
8.3.70.0090.00916.49
8.3.60.0110.00716.88
8.3.50.0130.00823.82
8.3.40.0130.00319.06
8.3.30.0070.00718.61
8.3.20.0040.00420.69
8.3.10.0080.00021.73
8.3.00.0080.00021.85
8.2.290.0150.00616.64
8.2.280.0120.00818.58
8.2.270.0070.01017.20
8.2.260.0040.01516.63
8.2.250.0080.00818.80
8.2.240.0060.00317.18
8.2.230.0030.00620.94
8.2.220.0060.00337.54
8.2.210.0140.00426.77
8.2.200.0070.00316.88
8.2.190.0070.01418.79
8.2.180.0070.00718.54
8.2.170.0090.00622.96
8.2.160.0090.00520.57
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00419.66
8.2.110.0080.00321.10
8.2.100.0060.00617.72
8.2.90.0090.00019.17
8.2.80.0030.00618.04
8.2.70.0000.00817.88
8.2.60.0030.00517.93
8.2.50.0030.00618.07
8.2.40.0040.00418.10
8.2.30.0050.00217.96
8.2.20.0000.00718.06
8.2.10.0000.00719.33
8.2.00.0050.00319.31
8.1.330.0110.00716.26
8.1.320.0120.00817.98
8.1.310.0040.00418.40
8.1.300.0040.00418.31
8.1.290.0090.00018.88
8.1.280.0070.01025.92
8.1.270.0000.00722.12
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.19
8.1.230.0070.00417.77
8.1.220.0000.00817.76
8.1.210.0050.00318.77
8.1.200.0000.00917.25
8.1.190.0080.00017.36
8.1.180.0000.00818.10
8.1.170.0000.00918.73
8.1.160.0000.00718.83
8.1.150.0030.00618.94
8.1.140.0060.00320.79
8.1.130.0030.00320.28
8.1.120.0040.00417.60
8.1.110.0000.00817.59
8.1.100.0080.00017.60
8.1.90.0100.00317.56
8.1.80.0060.00517.56
8.1.70.0090.00517.52
8.1.60.0070.00617.69
8.1.50.0150.00217.62
8.1.40.0120.00417.62
8.1.30.0070.00717.76
8.1.20.0110.00617.73
8.1.10.0110.00517.64
8.1.00.0030.00917.52
8.0.300.0000.01118.77
8.0.290.0060.00316.88
8.0.280.0040.00418.39
8.0.270.0030.00318.15
8.0.260.0000.00620.09
8.0.250.0040.00416.98
8.0.240.0030.00317.03
8.0.230.0000.00716.97
8.0.220.0010.00816.98
8.0.210.0080.00417.02
8.0.200.0090.00417.05
8.0.190.0090.00517.02
8.0.180.0110.00317.00
8.0.170.0090.00516.92
8.0.160.0080.00616.96
8.0.150.0100.00516.88
8.0.140.0070.00716.90
8.0.130.0090.00515.76
8.0.120.0060.00816.98
8.0.110.0060.00716.94
8.0.100.0090.00517.00
8.0.90.0120.00216.92
8.0.80.0060.01017.01
8.0.70.0110.00316.97
8.0.60.0080.00616.92
8.0.50.0060.00716.91
8.0.30.0080.00817.04
8.0.20.0120.00717.18
8.0.10.0110.00217.06
8.0.00.0120.00616.96
7.4.330.0000.00616.71
7.4.320.0040.00416.81
7.4.300.0080.00616.77
7.4.290.0060.00716.76
7.4.280.0090.00616.67
7.4.270.0070.00716.74
7.4.260.0080.00515.65
7.4.250.0100.00416.67
7.4.240.0070.00516.62
7.4.230.0100.00416.80
7.4.220.0070.00416.74
7.4.210.0110.00416.69
7.4.200.0070.00616.77
7.4.190.0090.00716.82
7.4.180.0130.00316.71
7.4.160.0090.00616.76
7.4.150.0130.00116.76
7.4.140.0130.00417.09
7.4.130.0120.00416.66
7.4.120.0060.00716.76
7.4.110.0080.00516.59
7.4.100.0070.00616.67
7.4.90.0050.00616.66
7.4.80.0080.00517.58
7.4.70.0100.00416.74
7.4.60.0080.00316.70
7.4.50.0040.00616.61
7.4.40.0060.00616.63
7.4.30.0050.00516.56
7.4.20.0080.00616.54
7.4.10.0060.00816.38
7.4.00.0090.00416.61
7.3.330.0110.00316.34
7.3.320.0080.00515.33
7.3.310.0120.00116.37
7.3.300.0080.00516.46
7.3.290.0070.00716.45
7.3.280.0060.01116.36
7.3.270.0110.00516.49
7.3.260.0130.01216.41
7.3.250.0160.00216.51
7.3.240.0140.00216.36
7.3.230.0100.00716.46
7.3.220.0120.00416.45
7.3.210.0130.00316.52
7.3.200.0120.00416.50
7.3.190.0100.00716.42
7.3.180.0100.00616.56
7.3.170.0060.01116.46
7.3.160.0080.00816.38
7.3.150.0120.00416.44
7.3.140.0090.00916.30
7.3.130.0120.00516.35
7.3.120.0100.00616.43
7.3.110.0130.00316.29
7.3.100.0100.00616.22
7.3.90.0080.00816.61
7.3.80.0140.00316.52
7.3.70.0090.00616.45
7.3.60.0080.00916.37
7.3.50.0080.00816.56
7.3.40.0100.00616.56
7.3.30.0100.00616.47
7.3.20.0110.00717.15
7.3.10.0110.00617.07
7.3.00.0110.00717.11
7.2.340.0110.00516.46
7.2.330.0120.00516.72
7.2.320.0090.00716.68
7.2.310.0140.00316.67
7.2.300.0110.00616.61
7.2.290.0110.00516.68
7.2.280.0110.00416.54
7.2.270.0120.00616.54
7.2.260.0140.00216.56
7.2.250.0100.00616.62
7.2.240.0100.00716.64
7.2.230.0080.00816.57
7.2.220.0110.00616.63
7.2.210.0120.00716.67
7.2.200.0140.00316.76
7.2.190.0130.00616.69
7.2.180.0080.00816.77
7.2.170.0090.00816.66
7.2.160.0130.00316.64
7.2.150.0150.00517.46
7.2.140.0140.00317.31
7.2.130.0060.01117.49
7.2.120.0130.00417.33
7.2.110.0100.00717.40
7.2.100.0130.00417.31
7.2.90.0100.00818.03
7.2.80.0160.00517.90
7.2.70.0120.00617.98
7.2.60.0090.00918.02
7.2.50.0110.00718.04
7.2.40.0120.00517.97
7.2.30.0150.00517.98
7.2.20.0110.00717.94
7.2.10.0110.00617.84
7.2.00.0130.00417.89

preferences:
29.26 ms | 403 KiB | 5 Q