3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/mr/product'; $routes = [ 'primary' => [ 'pattern' => '#/(?P<resource>[^/\\\\.,;?\n]+)/foobar#', 'default' => [ 'action' => 'standard', ], ], 'secundary' => [ 'pattern' => '#^/(?P<id>[0-9]+)(?:/(?P<resource>[^/\\\\.,;?\n]+)(?:/(?P<action>[^/\\\\.,;?\n]+))?)?$#', 'default' => [ 'resource' => 'catalog', 'action' => 'view', ] ], 'fallback' => [ 'pattern' => '#^.*$#', 'default' => [ 'resource' => 'main', 'action' => 'landing', ], ], ]; $current = null; // matching the route foreach ($routes as $name => $route) { $matches = []; if ( preg_match( $route['pattern'], $url, $matches ) ) { $current = $name; $matches = $matches + $route['default']; break; } } // cleaning up results foreach ( array_keys($matches) as $key ) { if ( is_numeric($key) ) { unset( $matches[$key] ); } } // view results print_r( $current ); print_r( $matches );

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.0040.01118.43
8.3.50.0070.00722.11
8.3.40.0060.00918.95
8.3.30.0130.00318.70
8.3.20.0080.00018.87
8.3.10.0030.00520.95
8.3.00.0050.00319.79
8.2.180.0110.00717.00
8.2.170.0030.01722.96
8.2.160.0090.00620.47
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00921.31
8.2.110.0040.00720.39
8.2.100.0090.00318.16
8.2.90.0050.00319.21
8.2.80.0040.00419.05
8.2.70.0050.00317.75
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0030.00618.34
8.2.30.0060.00321.36
8.2.20.0070.00018.02
8.2.10.0020.00517.97
8.2.00.0080.00017.99
8.1.280.0070.01125.92
8.1.270.0040.00423.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00622.56
8.1.230.0040.00721.05
8.1.220.0040.00418.77
8.1.210.0040.00418.85
8.1.200.0060.00317.48
8.1.190.0040.00417.51
8.1.180.0050.00318.10
8.1.170.0050.00318.72
8.1.160.0060.00318.95
8.1.150.0000.00818.79
8.1.140.0030.00517.54
8.1.130.0030.00317.78
8.1.120.0040.00417.59
8.1.110.0040.00417.55
8.1.100.0040.00417.52
8.1.90.0040.00417.59
8.1.80.0030.00517.66
8.1.70.0000.00717.61
8.1.60.0030.00617.63
8.1.50.0070.00017.53
8.1.40.0000.00817.70
8.1.30.0000.00817.68
8.1.20.0030.00517.81
8.1.10.0040.00417.75
8.1.00.0000.00817.68
8.0.300.0050.00320.04
8.0.290.0040.00417.15
8.0.280.0070.00018.46
8.0.270.0000.00717.29
8.0.260.0070.00017.04
8.0.250.0080.00017.14
8.0.240.0100.00017.09
8.0.230.0030.00317.21
8.0.220.0000.00717.11
8.0.210.0030.00317.16
8.0.200.0060.00017.09
8.0.190.0050.00217.04
8.0.180.0040.00417.15
8.0.170.0050.00317.06
8.0.160.0070.00017.19
8.0.150.0030.00617.05
8.0.140.0000.00916.99
8.0.130.0000.00513.50
8.0.120.0080.00017.11
8.0.110.0040.00416.90
8.0.100.0050.00217.06
8.0.90.0000.00717.06
8.0.80.0100.00717.07
8.0.70.0070.00016.95
8.0.60.0040.00416.98
8.0.50.0040.00417.01
8.0.30.0070.01317.29
8.0.20.0080.01017.40
8.0.10.0040.00417.23
8.0.00.0090.01116.99
7.4.330.0020.00215.07
7.4.320.0030.00516.75
7.4.300.0070.00016.75
7.4.290.0000.00716.71
7.4.280.0070.00016.80
7.4.270.0000.00716.64
7.4.260.0050.00013.53
7.4.250.0000.00816.80
7.4.240.0080.00016.83
7.4.230.0050.00316.80
7.4.220.0090.00616.73
7.4.210.0100.00616.78
7.4.200.0050.00316.62
7.4.190.0040.00416.87
7.4.160.0080.00816.84
7.4.150.0060.01217.40
7.4.140.0090.00817.86
7.4.130.0090.01016.73
7.4.120.0060.01116.70
7.4.110.0100.01416.64
7.4.100.0150.00916.85
7.4.90.0110.00716.68
7.4.80.0130.00319.39
7.4.70.0100.00716.57
7.4.60.0070.01016.58
7.4.50.0000.00916.55
7.4.40.0120.00322.77
7.4.30.0090.01216.78
7.4.00.0000.01515.10
7.3.330.0030.00313.32
7.3.320.0040.00413.21
7.3.310.0040.00416.34
7.3.300.0030.00316.52
7.3.290.0050.00816.54
7.3.280.0070.00916.52
7.3.270.0090.00917.40
7.3.260.0120.00918.24
7.3.250.0080.00916.66
7.3.240.0110.00716.54
7.3.230.0070.01416.84
7.3.210.0140.00316.82
7.3.200.0100.01019.39
7.3.190.0060.01116.39
7.3.180.0030.01416.75
7.3.170.0110.00616.63
7.3.160.0090.00616.58
7.3.120.0030.01515.04
7.3.10.0030.01416.91
7.3.00.0040.01116.82
7.2.330.0070.01116.68
7.2.320.0120.00616.88
7.2.310.0090.00917.00
7.2.300.0100.00717.00
7.2.290.0140.00316.76
7.2.130.0080.00416.88
7.2.120.0030.01016.94
7.2.110.0110.00417.24
7.2.100.0130.00017.03
7.2.90.0110.00417.15
7.2.80.0090.00316.96
7.2.70.0040.01117.22
7.2.60.0040.01216.93
7.2.50.0070.01117.08
7.2.40.0080.00417.13
7.2.30.0110.00416.80
7.2.20.0030.01317.16
7.2.10.0060.00616.98
7.2.00.0110.00218.34
7.1.250.0080.00815.91
7.1.100.0030.01018.26
7.1.70.0050.01017.29
7.1.60.0080.00817.26
7.1.50.0070.00717.22
7.1.40.0080.01516.95
7.1.30.0100.01517.09
7.1.20.0080.01117.02
7.1.10.0000.00816.70
7.1.00.0050.00316.80
7.0.200.0040.01416.97
7.0.190.0060.00617.05
7.0.180.0000.01716.48
7.0.170.0090.00716.54
7.0.160.0080.00816.48
7.0.150.0060.00316.51
7.0.140.0000.01116.54
7.0.130.0060.00316.61
7.0.120.0030.00516.72
7.0.110.0040.00716.83
7.0.100.0040.00416.48
7.0.90.0000.02116.64
7.0.80.0000.01416.48
7.0.70.0040.00416.69
7.0.60.0030.00616.63
7.0.50.0080.00816.70
7.0.40.0000.00816.48
7.0.30.0070.00716.48
7.0.20.0000.01016.48
7.0.10.0040.00716.48
7.0.00.0040.00416.48
5.6.300.0070.06620.86
5.6.290.0030.04420.70
5.6.280.0030.04020.96
5.6.270.0030.04320.88
5.6.260.0100.07620.77
5.6.250.0000.04720.77
5.6.240.0000.05220.86
5.6.230.0100.05020.96
5.6.220.0030.04020.82
5.6.210.0000.04321.12
5.6.200.0000.04520.86
5.6.190.0000.05720.82
5.6.180.0070.04720.82
5.6.170.0070.06321.02
5.6.160.0030.04120.98
5.6.150.0070.04020.80
5.6.140.0030.05020.91
5.6.130.0030.07320.76
5.6.120.0000.04720.91
5.6.110.0070.07120.91
5.6.100.0000.05020.94
5.6.90.0030.03920.84
5.6.80.0070.03720.30
5.6.70.0060.07120.18
5.6.60.0070.03620.21
5.6.50.0070.04220.38
5.6.40.0030.04720.27
5.6.30.0070.03820.20
5.6.20.0100.05220.18
5.6.10.0070.03720.08
5.6.00.0030.05120.07
5.5.380.0000.05217.51
5.5.370.0030.05517.54
5.5.360.0030.04917.47
5.5.350.0060.03517.55
5.5.340.0000.05017.97
5.5.330.0100.03718.04
5.5.320.0160.02917.94
5.5.310.0000.04417.86
5.5.300.0100.04917.97
5.5.290.0130.03818.03
5.5.280.0030.04317.70
5.5.270.0040.04218.02
5.5.260.0030.04417.96
5.5.250.0030.05617.84
5.5.240.0030.05417.41
5.5.230.0030.05217.40
5.5.220.0000.04017.41
5.5.210.0060.04217.33
5.5.200.0030.03717.46
5.5.190.0070.04617.29
5.5.180.0070.05617.37
5.5.160.0030.05417.18
5.5.150.0030.05417.28
5.5.140.0100.03817.37
5.5.130.0070.04417.18
5.5.120.0070.04217.32
5.5.110.0030.04117.46
5.5.100.0220.02917.10
5.5.90.0000.04717.27
5.5.80.0000.04217.24
5.5.70.0060.04517.21
5.5.60.0030.04017.26
5.5.50.0030.03917.25
5.5.40.0030.03817.23
5.5.30.0030.03917.20
5.5.20.0170.04416.94
5.5.10.0090.03117.27
5.5.00.0030.03917.26
5.4.450.0030.05219.31
5.4.440.0000.04419.34
5.4.430.0130.03319.15
5.4.420.0060.03619.27
5.4.410.0100.04919.27
5.4.400.0070.04918.98
5.4.390.0030.06019.18
5.4.380.0030.04118.89
5.4.370.0170.03018.93
5.4.360.0170.04118.84
5.4.350.0040.04218.91
5.4.340.0060.03818.93
5.4.320.0120.04019.05
5.4.310.0000.04519.17
5.4.300.0100.04218.85
5.4.290.0030.04019.03
5.4.280.0000.04519.05
5.4.270.0130.04018.98
5.4.260.0060.03419.04
5.4.250.0040.03918.90
5.4.240.0030.03919.14
5.4.230.0000.04719.03
5.4.220.0030.04718.81
5.4.210.0070.03418.98
5.4.200.0110.03618.88
5.4.190.0070.04919.03
5.4.180.0000.04219.02
5.4.170.0060.04119.17
5.4.160.0060.03719.04
5.4.150.0000.04119.07
5.4.140.0070.05716.61
5.4.130.0060.04516.67
5.4.120.0030.03816.63
5.4.110.0040.03916.48
5.4.100.0090.03816.48
5.4.90.0000.03716.74
5.4.80.0000.04016.69
5.4.70.0070.03016.67
5.4.60.0030.04216.60
5.4.50.0030.03716.65
5.4.40.0000.04116.65
5.4.30.0060.03116.48
5.4.20.0060.03216.63
5.4.10.0140.04416.63
5.4.00.0100.04916.48
5.3.290.0070.07016.48
5.3.280.0000.04216.48
5.3.270.0000.04216.48
5.3.260.0030.04316.48
5.3.250.0030.05316.48
5.3.240.0060.03516.48
5.3.230.0160.04616.48
5.3.220.0030.03816.48
5.3.210.0000.04716.48
5.3.200.0000.04216.48
5.3.190.0000.04316.48
5.3.180.0030.03516.48
5.3.170.0030.05116.48
5.3.160.0060.04516.48
5.3.150.0040.04016.48
5.3.140.0090.06316.48
5.3.130.0000.05216.48
5.3.120.0070.03416.48
5.3.110.0100.06616.48
5.3.100.0030.03816.48
5.3.90.0030.03416.48
5.3.80.0000.04616.48
5.3.70.0070.05716.48
5.3.60.0030.06216.48
5.3.50.0070.06716.48
5.3.40.0030.06416.48
5.3.30.0000.04516.48
5.3.20.0070.04916.48
5.3.10.0030.03716.48
5.3.00.0030.04016.48
5.2.170.0070.06416.48
5.2.160.0000.04016.48
5.2.150.0000.05216.48
5.2.140.0030.06116.48
5.2.130.0100.04516.48
5.2.120.0030.05916.48
5.2.110.0030.03216.48
5.2.100.0060.02616.48
5.2.90.0070.05916.48
5.2.80.0030.06216.48
5.2.70.0000.03716.48
5.2.60.0030.04116.48
5.2.50.0000.03216.48
5.2.40.0030.03016.48
5.2.30.0070.02816.48
5.2.20.0000.03216.48
5.2.10.0060.04016.48
5.2.00.0000.03116.48
5.1.60.0000.02816.48
5.1.50.0060.02216.48
5.1.40.0000.03016.48
5.1.30.0090.02016.48
5.1.20.0000.06116.48
5.1.10.0000.03616.48
5.1.00.0060.02116.48
5.0.50.0040.01916.48
5.0.40.0030.05216.48
5.0.30.0000.03916.48
5.0.20.0060.02116.48
5.0.10.0000.02216.48
5.0.00.0000.03216.48
4.4.90.0000.03616.48
4.4.80.0000.02016.48
4.4.70.0040.01416.48
4.4.60.0000.02516.48
4.4.50.0030.03016.48
4.4.40.0000.02616.48
4.4.30.0030.01316.48
4.4.20.0000.01816.48
4.4.10.0040.01416.48
4.4.00.0000.02616.48
4.3.110.0060.01116.48
4.3.100.0030.02716.48
4.3.90.0030.01516.48
4.3.80.0030.02216.48
4.3.70.0030.02016.48
4.3.60.0030.01816.48
4.3.50.0030.01716.48
4.3.40.0000.05716.48
4.3.30.0030.01716.48
4.3.20.0030.01616.48
4.3.10.0030.01616.48
4.3.00.0000.01616.48

preferences:
45.7 ms | 401 KiB | 5 Q