3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/12345/product/list'; $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 var_dump( $current, $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.0120.00316.75
8.3.50.0110.01122.05
8.3.40.0090.00618.91
8.3.30.0160.00618.93
8.3.20.0080.00020.21
8.3.10.0000.00823.52
8.3.00.0000.00823.61
8.2.180.0040.01116.88
8.2.170.0100.01022.96
8.2.160.0070.00722.38
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00321.18
8.2.120.0040.00426.35
8.2.110.0060.00319.51
8.2.100.0030.00917.93
8.2.90.0000.00819.26
8.2.80.0040.00417.97
8.2.70.0030.00717.87
8.2.60.0030.00617.93
8.2.50.0030.00618.09
8.2.40.0000.00820.56
8.2.30.0040.00419.58
8.2.20.0000.00817.93
8.2.10.0000.00718.08
8.2.00.0040.00418.26
8.1.280.0070.01625.92
8.1.270.0040.00422.06
8.1.260.0040.00728.09
8.1.250.0040.00428.09
8.1.240.0000.01122.61
8.1.230.0060.00617.70
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0000.00817.35
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.59
8.1.160.0030.00520.77
8.1.150.0000.00818.93
8.1.140.0080.00019.63
8.1.130.0050.00217.71
8.1.120.0050.00217.63
8.1.110.0070.00017.64
8.1.100.0080.00017.59
8.1.90.0000.00817.62
8.1.80.0040.00417.52
8.1.70.0000.00717.58
8.1.60.0070.00017.64
8.1.50.0060.00317.51
8.1.40.0100.00017.75
8.1.30.0000.00817.73
8.1.20.0090.00017.64
8.1.10.0070.00017.70
8.1.00.0000.00817.70
8.0.300.0000.00818.77
8.0.290.0070.00016.88
8.0.280.0000.00718.41
8.0.270.0030.00617.27
8.0.260.0040.00417.29
8.0.250.0000.00717.11
8.0.240.0040.00417.15
8.0.230.0040.00417.18
8.0.220.0000.00717.12
8.0.210.0000.00717.17
8.0.200.0030.00317.03
8.0.190.0030.00617.21
8.0.180.0040.00417.15
8.0.170.0020.00517.11
8.0.160.0000.00716.98
8.0.150.0000.00716.95
8.0.140.0000.00817.13
8.0.130.0000.00613.57
8.0.120.0040.00416.97
8.0.110.0020.00517.05
8.0.100.0040.00417.07
8.0.90.0080.00017.11
8.0.80.0100.01017.18
8.0.70.0040.00417.14
8.0.60.0030.00516.95
8.0.50.0040.00416.98
8.0.30.0060.01417.37
8.0.20.0120.00817.40
8.0.10.0000.00717.11
8.0.00.0080.01216.83
7.4.330.0030.00316.91
7.4.320.0040.00416.63
7.4.300.0030.00316.72
7.4.290.0070.00016.77
7.4.280.0070.00016.73
7.4.270.0000.00816.74
7.4.260.0060.00616.73
7.4.250.0040.00416.69
7.4.240.0040.00416.85
7.4.230.0080.00016.84
7.4.220.0040.01416.71
7.4.210.0110.00516.88
7.4.200.0000.00716.86
7.4.160.0150.00017.00
7.4.150.0110.00717.40
7.4.140.0130.00717.86
7.4.130.0100.00916.69
7.4.120.0120.00916.69
7.4.110.0130.02216.70
7.4.100.0140.00316.59
7.4.90.0040.01416.74
7.4.80.0200.00319.39
7.4.70.0110.00716.68
7.4.60.0100.00716.98
7.4.50.0030.01116.49
7.4.40.0030.01616.74
7.4.30.0090.00916.71
7.4.00.0060.01215.12
7.3.330.0000.00713.30
7.3.320.0030.00313.47
7.3.310.0030.00516.56
7.3.300.0030.00316.48
7.3.290.0110.00716.48
7.3.280.0090.01116.46
7.3.270.0070.01017.40
7.3.260.0160.00316.89
7.3.250.0150.00416.54
7.3.240.0120.00716.64
7.3.230.0070.01416.57
7.3.210.0090.01216.41
7.3.200.0060.01619.39
7.3.190.0120.00616.76
7.3.180.0110.00516.45
7.3.170.0100.00616.74
7.3.160.0040.01216.90
7.3.120.0070.01215.07
7.3.110.0070.01115.05
7.3.100.0030.01015.15
7.3.90.0080.00515.17
7.3.80.0110.00314.94
7.3.70.0080.00714.73
7.3.60.0060.00715.01
7.3.50.0080.00614.92
7.3.40.0070.00814.88
7.3.30.0050.00614.92
7.3.20.0060.00616.74
7.3.10.0030.00816.54
7.3.00.0050.00816.79
7.2.330.0130.00517.05
7.2.320.0090.01516.79
7.2.310.0030.01916.89
7.2.300.0060.01216.77
7.2.290.0080.00816.62
7.2.250.0030.01615.27
7.2.240.0080.01015.13
7.2.230.0090.00615.12
7.2.220.0060.00315.38
7.2.210.0050.01215.17
7.2.200.0050.01215.39
7.2.190.0060.00815.13
7.2.180.0100.00615.28
7.2.170.0120.00315.27
7.2.00.0040.01519.75
7.1.330.0040.00915.97
7.1.320.0030.00616.22
7.1.310.0110.00515.90
7.1.300.0060.00816.08
7.1.290.0030.00916.05
7.1.280.0070.00716.02
7.1.270.0010.00915.98
7.1.260.0090.00415.91
7.1.100.0000.01618.57
7.1.70.0000.00817.47
7.1.60.0060.00619.40
7.1.50.0040.00716.91
7.1.00.0000.07722.50
7.0.200.0030.00716.62
7.0.100.0070.07020.04
7.0.90.0070.04720.02
7.0.80.0470.10019.92
7.0.70.0530.07319.86
7.0.60.0370.08020.05
7.0.50.0330.07720.33
7.0.40.0100.04320.08
7.0.30.0130.07020.18
7.0.20.0070.08320.08
7.0.10.0130.07320.14
7.0.00.0000.07320.13
5.6.280.0000.03720.86
5.6.250.0100.06720.69
5.6.240.0130.08720.57
5.6.230.0030.09320.53
5.6.220.0130.07720.49
5.6.210.0100.06720.66
5.6.200.0030.09321.05
5.6.190.0130.07021.09
5.6.180.0100.05321.03
5.6.170.0070.08721.18
5.6.160.0170.07021.11
5.6.150.0100.06320.95
5.6.140.0170.07321.16
5.6.130.0070.08721.02
5.6.120.0170.04321.06
5.6.110.0030.07320.95
5.6.100.0100.08021.00
5.6.90.0070.08021.09
5.6.80.0130.06720.49
5.6.70.0000.07320.51
5.6.60.0130.07720.38
5.6.50.0100.07320.49
5.6.40.0100.06320.30
5.6.30.0030.07320.38
5.6.20.0070.05720.42
5.6.10.0070.07720.36
5.6.00.0030.08320.35
5.5.380.0130.07720.36
5.5.370.0200.06320.52
5.5.360.0070.08320.50
5.5.350.0100.07720.40
5.5.340.0070.07020.84
5.5.330.0100.07020.83
5.5.320.0000.08720.76
5.5.310.0070.08020.73
5.5.300.0100.07320.73
5.5.290.0130.07720.76
5.5.280.0100.08020.90
5.5.270.0030.08320.79
5.5.260.0200.07320.71
5.5.250.0070.06720.68
5.5.240.0030.08720.27
5.5.230.0000.09020.14
5.5.220.0130.07720.15
5.5.210.0070.07720.25
5.5.200.0030.08020.25
5.5.190.0100.07320.11
5.5.180.0070.07720.23
5.5.160.0130.07320.15
5.5.150.0070.05020.08
5.5.140.0030.07720.29
5.5.130.0030.04720.23
5.5.120.0130.04320.29
5.5.110.0170.03720.15
5.5.100.0070.05320.10
5.5.90.0000.04020.07
5.5.80.0100.03020.17
5.5.70.0000.05020.06
5.5.60.0000.04320.06
5.5.50.0070.04319.93
5.5.40.0000.04320.15
5.5.30.0070.04020.06
5.5.20.0130.03720.08
5.5.10.0030.04019.98
5.5.00.0100.03320.03

preferences:
48.29 ms | 401 KiB | 5 Q