3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/12345/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.0070.00718.31
8.3.50.0060.00922.24
8.3.40.0150.00319.06
8.3.30.0110.00318.79
8.3.20.0060.00318.91
8.3.10.0030.00620.95
8.3.00.0000.01119.67
8.2.180.0070.01416.63
8.2.170.0000.01522.96
8.2.160.0130.00020.35
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0040.00421.16
8.2.110.0100.00020.52
8.2.100.0040.00817.97
8.2.90.0050.00319.22
8.2.80.0000.00819.21
8.2.70.0040.00817.88
8.2.60.0040.00417.91
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0040.00421.19
8.2.20.0040.00417.82
8.2.10.0000.00717.84
8.2.00.0000.00817.88
8.1.280.0100.00325.92
8.1.270.0000.00823.99
8.1.260.0060.00326.35
8.1.250.0050.00228.09
8.1.240.0000.01022.56
8.1.230.0110.00020.84
8.1.220.0040.00418.77
8.1.210.0080.00418.96
8.1.200.0040.00717.48
8.1.190.0040.00417.16
8.1.180.0050.00318.10
8.1.170.0050.00318.63
8.1.160.0040.00418.96
8.1.150.0000.00818.91
8.1.140.0040.00417.64
8.1.130.0070.00017.80
8.1.120.0000.00717.58
8.1.110.0070.00017.46
8.1.100.0070.00017.65
8.1.90.0080.00017.61
8.1.80.0050.00317.64
8.1.70.0000.00717.57
8.1.60.0040.00417.63
8.1.50.0000.00817.65
8.1.40.0000.00817.59
8.1.30.0000.00817.77
8.1.20.0060.00317.82
8.1.10.0030.00617.65
8.1.00.0060.00317.75
8.0.300.0050.00220.07
8.0.290.0070.00017.05
8.0.280.0080.00018.46
8.0.270.0000.00717.38
8.0.260.0000.00717.09
8.0.250.0070.00017.17
8.0.240.0060.00317.18
8.0.230.0030.00317.06
8.0.220.0040.00417.14
8.0.210.0050.00317.13
8.0.200.0030.00317.04
8.0.190.0030.00517.15
8.0.180.0000.00817.08
8.0.170.0040.00417.18
8.0.160.0000.00717.00
8.0.150.0000.00816.96
8.0.140.0000.01117.11
8.0.130.0060.00013.50
8.0.120.0060.00317.08
8.0.110.0040.00417.13
8.0.100.0040.00417.13
8.0.90.0080.00017.13
8.0.80.0040.01417.04
8.0.70.0050.00317.18
8.0.60.0000.00816.90
8.0.50.0050.00317.16
8.0.30.0110.01117.33
8.0.20.0080.01117.40
8.0.10.0080.00017.21
8.0.00.0120.00916.85
7.4.330.0000.00515.01
7.4.320.0030.00316.64
7.4.300.0070.00016.77
7.4.290.0000.00816.83
7.4.280.0000.00716.61
7.4.270.0050.00216.66
7.4.260.0050.00013.40
7.4.250.0070.00016.59
7.4.240.0030.00316.87
7.4.230.0000.00716.91
7.4.220.0170.00716.85
7.4.210.0090.01016.74
7.4.200.0030.00516.71
7.4.190.0000.00716.86
7.4.160.0060.01216.57
7.4.150.0150.00917.40
7.4.140.0090.00817.86
7.4.130.0080.00816.63
7.4.120.0120.00716.62
7.4.110.0130.01016.65
7.4.100.0090.00916.72
7.4.90.0120.00616.91
7.4.80.0060.01219.39
7.4.70.0110.00616.72
7.4.60.0100.00716.87
7.4.50.0000.00916.46
7.4.40.0090.00422.77
7.4.30.0060.00916.63
7.4.10.0070.01115.51
7.4.00.0080.01015.27
7.3.330.0050.00013.36
7.3.320.0060.00013.27
7.3.310.0000.00716.56
7.3.300.0000.00616.54
7.3.290.0130.00316.50
7.3.280.0090.00916.47
7.3.270.0120.00617.40
7.3.260.0110.00718.24
7.3.250.0110.00616.70
7.3.240.0130.00616.62
7.3.230.0130.00316.53
7.3.210.0100.00716.51
7.3.200.0070.01719.39
7.3.190.0090.00916.87
7.3.180.0080.00916.73
7.3.170.0030.01516.80
7.3.160.0170.00016.51
7.3.130.0060.01015.03
7.3.120.0040.01214.92
7.3.110.0070.01215.19
7.3.100.0020.01115.31
7.3.90.0070.00714.88
7.3.80.0100.00614.95
7.3.70.0050.01015.14
7.3.60.0020.01515.11
7.3.50.0060.00815.17
7.3.40.0030.01115.09
7.3.30.0060.00915.00
7.3.20.0100.00316.90
7.3.10.0100.00616.70
7.3.00.0120.00316.71
7.2.330.0070.01016.88
7.2.320.0090.00916.95
7.2.310.0130.00616.95
7.2.300.0080.00816.87
7.2.290.0060.01016.68
7.2.260.0000.01615.04
7.2.250.0060.01115.01
7.2.240.0060.01115.26
7.2.230.0050.01015.20
7.2.220.0110.00515.18
7.2.210.0030.01115.36
7.2.200.0030.01115.14
7.2.190.0080.00515.01
7.2.180.0030.01115.31
7.2.170.0060.00615.26
7.2.160.0060.01015.24
7.2.150.0040.01117.21
7.2.140.0070.00717.14
7.2.130.0140.00317.00
7.2.120.0080.01017.04
7.2.110.0070.00816.89
7.2.100.0060.00916.99
7.2.90.0080.00716.93
7.2.80.0100.00717.07
7.2.70.0080.00916.92
7.2.60.0060.00716.90
7.2.50.0090.00616.95
7.2.40.0120.00617.12
7.2.30.0040.01117.22
7.2.20.0060.01117.03
7.2.10.0060.01016.89
7.2.00.0080.00617.11
7.1.330.0030.01016.11
7.1.320.0030.00916.03
7.1.310.0070.00616.02
7.1.300.0060.00615.79
7.1.290.0040.00816.06
7.1.280.0080.00315.89
7.1.270.0100.00115.80
7.1.260.0030.01116.08
7.1.250.0040.00915.91
7.1.240.0080.00215.99
7.1.230.0050.00615.95
7.1.220.0030.00916.00
7.1.210.0050.00716.12
7.1.200.0050.00416.07
7.1.190.0120.00316.06
7.1.180.0050.01016.03
7.1.170.0060.00816.09
7.1.160.0070.00916.08
7.1.150.0080.00516.12
7.1.140.0070.00615.81
7.1.130.0020.00716.06
7.1.120.0030.01116.00
7.1.110.0030.00815.99
7.1.100.0070.00416.12
7.1.90.0090.00715.86
7.1.80.0070.00415.81
7.1.70.0040.00716.34
7.1.60.0050.00916.53
7.1.50.0020.01116.30
7.1.40.0070.00516.19
7.1.30.0030.00816.31
7.1.20.0060.01116.31
7.1.10.0020.00816.22
7.1.00.0050.00416.24
7.0.330.0050.00815.57
7.0.320.0050.00615.59
7.0.310.0050.00815.52
7.0.300.0060.00715.63
7.0.290.0050.00915.71
7.0.280.0060.00615.53
7.0.270.0060.00615.60
7.0.260.0080.00215.48
7.0.250.0050.00815.65
7.0.240.0060.00815.70
7.0.230.0020.00915.50
7.0.220.0050.01015.59
7.0.210.0040.00615.49
7.0.200.0050.00715.86
7.0.190.0040.00816.01
7.0.180.0030.00815.86
7.0.170.0050.00815.94
7.0.160.0020.01015.90
7.0.150.0080.00515.87
7.0.140.0020.01215.90
7.0.130.0050.00515.96
7.0.120.0020.01215.87
7.0.110.0050.00915.92
7.0.100.0040.00515.91
7.0.90.0030.00915.94
7.0.80.0040.00815.90
7.0.70.0030.00916.02
7.0.60.0030.01015.90
7.0.50.0060.00715.93
7.0.40.0050.00714.66
7.0.30.0070.00614.65
7.0.20.0060.00614.63
7.0.10.0060.00514.57
7.0.00.0060.00614.66
5.6.400.0030.01014.55
5.6.390.0070.00714.80
5.6.380.0060.00814.47
5.6.370.0070.00614.73
5.6.360.0070.00514.49
5.6.350.0030.01014.34
5.6.340.0080.00514.73
5.6.330.0070.00514.57
5.6.320.0040.00914.55
5.6.310.0070.00914.09
5.6.300.0040.02116.55
5.6.290.0050.02216.69
5.6.280.0090.02816.58
5.6.270.0030.02716.66
5.6.260.0050.03316.60
5.6.250.0020.02316.57
5.6.240.0050.02016.57
5.6.230.0050.01816.47
5.6.220.0060.01916.66
5.6.210.0020.02116.72
5.6.200.0040.02716.62
5.6.190.0060.02116.62
5.6.180.0060.02616.61
5.6.170.0070.01716.61
5.6.160.0070.02016.53
5.6.150.0050.02216.58
5.6.140.0070.01516.57
5.6.130.0090.01516.63
5.6.120.0070.01816.49
5.6.110.0000.02316.48
5.6.100.0060.01816.66
5.6.90.0050.02016.63
5.6.80.0060.01816.45
5.6.70.0060.01616.22
5.6.60.0080.01716.27
5.6.50.0050.01816.46
5.6.40.0060.01816.21
5.6.30.0040.02016.30
5.6.20.0040.02116.14
5.6.10.0050.01716.40
5.6.00.0050.01716.40
5.5.380.0060.01514.31
5.5.370.0050.02914.46
5.5.360.0030.01914.28
5.5.350.0020.01914.35
5.5.340.0060.02914.45
5.5.330.0030.01814.54
5.5.320.0010.02114.48
5.5.310.0090.01614.46
5.5.300.0050.01714.65
5.5.290.0060.01914.38
5.5.280.0060.01814.49
5.5.270.0020.01914.64
5.5.260.0080.01714.66
5.5.250.0030.01914.49
5.5.240.0060.01614.29
5.5.230.0070.01714.38
5.5.220.0020.01914.19
5.5.210.0050.01714.25
5.5.200.0030.01914.19
5.5.190.0040.01914.22
5.5.180.0070.01614.28
5.5.170.0080.00712.80
5.5.160.0070.01314.36
5.5.150.0070.01714.31
5.5.140.0070.01814.22
5.5.130.0040.01914.33
5.5.120.0040.01714.38
5.5.110.0050.01814.38
5.5.100.0050.01814.23
5.5.90.0070.01514.15
5.5.80.0080.01414.34
5.5.70.0000.02314.24
5.5.60.0030.01814.22
5.5.50.0050.01814.06
5.5.40.0040.01714.16
5.5.30.0070.01414.26
5.5.20.0050.02014.16
5.5.10.0060.01614.28
5.5.00.0060.01714.26
5.4.450.0030.01914.75
5.4.440.0020.02314.87
5.4.430.0060.01514.80
5.4.420.0070.01614.80
5.4.410.0040.02014.65
5.4.400.0040.01614.56
5.4.390.0050.01414.66
5.4.380.0030.01714.53
5.4.370.0020.01914.57
5.4.360.0050.01514.65
5.4.350.0080.01314.60
5.4.340.0040.01714.49
5.4.330.0100.00312.32
5.4.320.0040.01614.56
5.4.310.0020.01914.60
5.4.300.0050.01714.67
5.4.290.0050.01614.52
5.4.280.0040.01714.66
5.4.270.0050.01714.57
5.4.260.0080.01414.56
5.4.250.0020.02114.54
5.4.240.0080.01614.48
5.4.230.0030.01714.54
5.4.220.0040.01714.63
5.4.210.0050.01514.54
5.4.200.0050.01714.56
5.4.190.0030.01714.44
5.4.180.0040.01814.51
5.4.170.0060.01614.51
5.4.160.0040.01514.52
5.4.150.0030.01714.48
5.4.140.0030.01613.79
5.4.130.0030.01613.76
5.4.120.0010.02013.84
5.4.110.0040.01713.80
5.4.100.0080.01413.77
5.4.90.0060.01513.78
5.4.80.0030.01613.80
5.4.70.0030.01713.76
5.4.60.0080.01313.80
5.4.50.0040.01313.76
5.4.40.0070.01513.82
5.4.30.0060.02813.79
5.4.20.0050.01413.72
5.4.10.0050.01613.81
5.4.00.0050.01413.75
5.3.290.0040.02013.52
5.3.280.0040.01713.52
5.3.270.0030.01613.52
5.3.260.0020.01613.52
5.3.250.0030.01713.52
5.3.240.0020.01713.52
5.3.230.0040.01513.52
5.3.220.0030.01913.52
5.3.210.0020.02113.52
5.3.200.0040.01713.52
5.3.190.0050.01413.52
5.3.180.0010.01913.56
5.3.170.0050.01213.55
5.3.160.0100.01313.54
5.3.150.0030.01713.54
5.3.140.0040.01613.52
5.3.130.0060.01713.52
5.3.120.0040.02213.52
5.3.110.0010.02313.52
5.3.100.0030.02713.52
5.3.90.0060.01513.53
5.3.80.0030.02613.52
5.3.70.0060.01313.52
5.3.60.0020.01713.52
5.3.50.0040.02613.52
5.3.40.0050.01913.52
5.3.30.0050.01813.52
5.3.20.0020.01813.52
5.3.10.0030.01713.52
5.3.00.0020.02513.52
5.2.170.0020.01913.38
5.2.160.0060.02913.38
5.2.150.0050.02913.38
5.2.140.0030.01913.38
5.2.130.0080.01313.38
5.2.120.0030.02813.38
5.2.110.0000.03813.38
5.2.100.0050.01413.38
5.2.90.0050.01613.38
5.2.80.0060.02013.38
5.2.70.0030.01713.38
5.2.60.0030.03513.38
5.2.50.0030.01713.38
5.2.40.0040.01413.38
5.2.30.0030.01713.38
5.2.20.0020.01813.38
5.2.10.0080.01413.38
5.2.00.0000.02013.38
5.1.60.0060.01113.38
5.1.50.0030.01713.38
5.1.40.0060.01213.38
5.1.30.0060.01313.38
5.1.20.0020.01513.38
5.1.10.0020.01613.38
5.1.00.0020.01513.38
5.0.50.0040.02213.38
5.0.40.0000.01513.38
5.0.30.0020.01813.38
5.0.20.0000.01413.38
5.0.10.0030.01013.38
5.0.00.0030.01613.38
4.4.90.0000.01113.38
4.4.80.0050.00613.38
4.4.70.0020.00813.38
4.4.60.0000.01213.38
4.4.50.0020.01013.38
4.4.40.0020.01913.38
4.4.30.0040.00713.38
4.4.20.0020.01013.38
4.4.10.0000.01113.38
4.4.00.0000.01613.38
4.3.110.0000.01213.38
4.3.100.0010.00913.38
4.3.90.0010.00913.38
4.3.80.0020.01313.38
4.3.70.0030.00813.38
4.3.60.0020.01013.38
4.3.50.0020.01013.38
4.3.40.0000.01413.38
4.3.30.0020.01013.38
4.3.20.0030.00913.38
4.3.10.0040.00713.38
4.3.00.0040.00813.38

preferences:
44.05 ms | 401 KiB | 5 Q