3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/12345/product/list/somevar'; $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.0180.00316.88
8.3.50.0120.00318.43
8.3.40.0160.00018.96
8.3.30.0120.00918.83
8.3.20.0120.00620.34
8.3.10.0000.00823.52
8.3.00.0060.00323.53
8.2.180.0120.00616.50
8.2.170.0070.01122.96
8.2.160.0040.01122.12
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0040.00421.13
8.2.110.0070.00319.39
8.2.100.0080.00418.16
8.2.90.0000.00919.22
8.2.80.0050.00317.97
8.2.70.0030.00617.88
8.2.60.0040.00417.93
8.2.50.0000.00918.09
8.2.40.0070.00220.42
8.2.30.0080.00019.52
8.2.20.0030.00618.11
8.2.10.0050.00318.18
8.2.00.0000.00818.06
8.1.280.0130.00725.92
8.1.270.0030.00522.06
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00422.65
8.1.230.0000.01117.70
8.1.220.0040.00417.77
8.1.210.0080.00018.77
8.1.200.0060.00317.36
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0050.00318.63
8.1.160.0070.00020.68
8.1.150.0050.00318.79
8.1.140.0000.00819.62
8.1.130.0040.00417.74
8.1.120.0070.00017.60
8.1.110.0000.00917.51
8.1.100.0050.00317.66
8.1.90.0040.00417.53
8.1.80.0030.00517.67
8.1.70.0000.00717.62
8.1.60.0030.00617.80
8.1.50.0040.00417.53
8.1.40.0060.00617.64
8.1.30.0050.00317.82
8.1.20.0030.00617.63
8.1.10.0040.00417.58
8.1.00.0000.00817.74
8.0.300.0000.00818.82
8.0.290.0000.00716.75
8.0.280.0050.00318.40
8.0.270.0060.00317.17
8.0.260.0050.00317.29
8.0.250.0070.00017.09
8.0.240.0030.00317.22
8.0.230.0000.00817.20
8.0.220.0040.00417.08
8.0.210.0000.00717.00
8.0.200.0000.00617.13
8.0.190.0060.00317.16
8.0.180.0000.00717.08
8.0.170.0000.00817.04
8.0.160.0080.00017.13
8.0.150.0040.00417.08
8.0.140.0000.00717.04
8.0.130.0060.00013.52
8.0.120.0080.00017.09
8.0.110.0040.00417.06
8.0.100.0040.00416.97
8.0.90.0040.00417.11
8.0.80.0180.00017.12
8.0.70.0040.00417.13
8.0.60.0000.00717.23
8.0.50.0050.00216.93
8.0.30.0100.00817.35
8.0.20.0090.01217.40
8.0.10.0050.00217.13
8.0.00.0070.01016.95
7.4.330.0050.00016.81
7.4.320.0000.00716.74
7.4.300.0060.00016.85
7.4.290.0070.00016.63
7.4.280.0000.00816.85
7.4.270.0070.00016.67
7.4.260.0100.00016.70
7.4.250.0040.00416.67
7.4.240.0000.00816.73
7.4.230.0030.00516.91
7.4.220.0110.00616.79
7.4.210.0090.00916.78
7.4.200.0000.00716.66
7.4.160.0040.01216.65
7.4.150.0180.00017.40
7.4.140.0110.00817.86
7.4.130.0130.00516.74
7.4.120.0060.01116.70
7.4.110.0260.02616.66
7.4.100.0110.01116.68
7.4.90.0070.01016.75
7.4.80.0110.00719.39
7.4.70.0070.01316.81
7.4.60.0160.00016.63
7.4.50.0080.01116.91
7.4.40.0100.00716.54
7.4.30.0030.01516.68
7.4.00.0080.00915.19
7.3.330.0000.00713.38
7.3.320.0000.00513.21
7.3.310.0040.00416.64
7.3.300.0040.00416.48
7.3.290.0080.01016.50
7.3.280.0130.00516.53
7.3.270.0090.00917.40
7.3.260.0130.01216.88
7.3.250.0060.01216.68
7.3.240.0080.01316.67
7.3.230.0110.00716.55
7.3.210.0110.00716.86
7.3.200.0130.00316.38
7.3.190.0050.01016.75
7.3.180.0070.01016.51
7.3.170.0130.00316.51
7.3.160.0040.01216.87
7.3.120.0120.00615.11
7.3.110.0090.00914.73
7.3.100.0040.01214.91
7.3.90.0090.00015.31
7.3.80.0060.00314.99
7.3.70.0100.00714.97
7.3.60.0060.00615.09
7.3.50.0000.01014.89
7.3.40.0070.00715.00
7.3.30.0080.00315.02
7.3.20.0090.00616.82
7.3.10.0100.00616.91
7.3.00.0030.01316.66
7.2.330.0030.01416.80
7.2.320.0030.01616.81
7.2.310.0030.01316.75
7.2.300.0100.00716.85
7.2.290.0030.01316.80
7.2.250.0080.01215.21
7.2.240.0090.01215.19
7.2.230.0000.01815.04
7.2.220.0040.00815.26
7.2.210.0030.01015.28
7.2.200.0030.01215.16
7.2.190.0000.00915.34
7.2.180.0040.01515.20
7.2.170.0070.01015.27
7.2.00.0040.00819.77
7.1.330.0030.00915.80
7.1.320.0060.00616.15
7.1.310.0060.01015.98
7.1.300.0000.01115.90
7.1.290.0120.00316.00
7.1.280.0130.00315.89
7.1.270.0030.00916.01
7.1.260.0070.00716.00
7.1.100.0000.01318.29
7.1.70.0040.00417.20
7.1.60.0090.00319.40
7.1.50.0070.01417.14
7.1.00.0030.07722.36
7.0.200.0030.00516.95
7.0.60.0200.08021.71
7.0.50.0070.03717.79
7.0.40.0100.08320.26
7.0.30.0230.08020.19
7.0.20.0300.05020.22
7.0.10.0130.08020.11
7.0.00.0100.08020.03
5.6.280.0030.03021.12
5.6.210.0100.07320.62
5.6.200.0070.06718.19
5.6.190.0130.08320.41
5.6.180.0270.06320.35
5.6.170.0230.03720.50
5.6.160.0130.07320.46
5.6.150.0130.07318.16
5.6.140.0070.08018.07
5.6.130.0000.05018.21
5.6.120.0130.08021.09
5.6.110.0100.08021.11
5.6.100.0030.04020.97
5.6.90.0100.05720.94
5.6.80.0100.07720.40
5.5.350.0230.07320.39
5.5.340.0130.05717.95
5.5.330.0030.04020.13
5.5.320.0570.06020.34
5.5.310.0330.06720.16
5.5.300.0030.04717.91
5.5.290.0070.07717.92
5.5.280.0170.07320.68
5.5.270.0130.08020.88
5.5.260.0170.07020.76
5.5.250.0000.04720.71
5.5.240.0130.08320.35

preferences:
55.38 ms | 401 KiB | 5 Q