3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/mr/poop'; $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.70.0100.01018.23
8.3.60.0070.00718.30
8.3.50.0070.01222.16
8.3.40.0120.00319.10
8.3.30.0120.00318.84
8.3.20.0050.00318.85
8.3.10.0030.00520.92
8.3.00.0080.00019.56
8.2.180.0070.01416.75
8.2.170.0100.00722.96
8.2.160.0070.00722.43
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0040.00726.16
8.2.120.0080.00021.09
8.2.110.0030.00622.24
8.2.100.0090.00318.16
8.2.90.0000.00819.26
8.2.80.0000.00917.97
8.2.70.0040.00417.88
8.2.60.0000.01017.93
8.2.50.0080.00018.07
8.2.40.0000.00918.34
8.2.30.0000.00721.35
8.2.20.0040.00417.90
8.2.10.0000.00818.04
8.2.00.0040.00417.88
8.1.280.0110.00425.92
8.1.270.0090.00923.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00622.01
8.1.230.0110.00017.70
8.1.220.0080.00017.78
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0030.00517.51
8.1.180.0030.00618.10
8.1.170.0050.00318.63
8.1.160.0040.00418.92
8.1.150.0000.00818.80
8.1.140.0000.00717.57
8.1.130.0000.00717.78
8.1.120.0080.00017.63
8.1.110.0080.00017.66
8.1.100.0070.00017.62
8.1.90.0000.00717.53
8.1.80.0030.00517.51
8.1.70.0030.00317.57
8.1.60.0030.00617.65
8.1.50.0040.00417.63
8.1.40.0030.00617.64
8.1.30.0000.00717.81
8.1.20.0030.00617.67
8.1.10.0040.00417.72
8.1.00.0000.00917.53
8.0.300.0070.00018.77
8.0.290.0050.00316.88
8.0.280.0000.00718.48
8.0.270.0000.00717.28
8.0.260.0040.00416.96
8.0.250.0040.00417.20
8.0.240.0000.00817.14
8.0.230.0040.00417.05
8.0.220.0030.00417.14
8.0.210.0030.00317.11
8.0.200.0030.00317.20
8.0.190.0030.00617.24
8.0.180.0030.00517.14
8.0.170.0000.00717.01
8.0.160.0030.00517.05
8.0.150.0000.00816.96
8.0.140.0070.00417.11
8.0.130.0060.00013.63
8.0.120.0000.00817.12
8.0.110.0080.00017.00
8.0.100.0060.00316.95
8.0.90.0050.00217.07
8.0.80.0120.00917.11
8.0.70.0030.00517.16
8.0.60.0000.00716.99
8.0.50.0070.00016.98
8.0.30.0110.00817.35
8.0.20.0160.00417.41
8.0.10.0040.00417.31
8.0.00.0080.01117.10
7.4.330.0050.00016.77
7.4.320.0070.00016.73
7.4.300.0000.00616.73
7.4.290.0000.00716.77
7.4.280.0000.00716.81
7.4.270.0000.00716.82
7.4.260.0000.00513.44
7.4.250.0050.00316.82
7.4.240.0000.00716.63
7.4.230.0040.00416.72
7.4.220.0090.00616.81
7.4.210.0050.01216.82
7.4.200.0040.00416.94
7.4.190.0030.00316.75
7.4.160.0180.00016.64
7.4.150.0150.00917.40
7.4.140.0110.00817.86
7.4.130.0090.00816.83
7.4.120.0080.01216.85
7.4.110.0100.00716.71
7.4.100.0140.00416.76
7.4.90.0150.00316.75
7.4.80.0090.01519.39
7.4.70.0030.01316.96
7.4.60.0060.01016.61
7.4.50.0030.00516.81
7.4.40.0070.00722.77
7.4.30.0100.00716.73
7.4.00.0100.00615.17
7.3.330.0030.00313.42
7.3.320.0020.00213.35
7.3.310.0030.00316.34
7.3.300.0000.00716.48
7.3.290.0040.01616.46
7.3.280.0090.00716.49
7.3.270.0130.00517.40
7.3.260.0090.01018.24
7.3.250.0080.01116.55
7.3.240.0140.00416.80
7.3.230.0130.00316.52
7.3.210.0130.00316.59
7.3.200.0130.00619.39
7.3.190.0130.00316.69
7.3.180.0060.01016.42
7.3.170.0100.01016.67
7.3.160.0080.00816.55
7.3.120.0030.00915.17
7.2.330.0060.01117.05
7.2.320.0070.01016.80
7.2.310.0060.01816.91
7.2.300.0060.01516.71
7.2.290.0060.01016.77
7.2.80.0100.00316.98
7.2.60.0000.01417.25
7.1.200.0040.00416.13
7.1.70.0060.00818.73
7.1.60.0000.01118.73
7.1.50.0050.00518.73
7.1.40.0030.01418.73
7.1.30.0070.00718.73
7.1.20.0030.01018.73
7.1.10.0070.01018.73
7.1.00.0000.01118.73
7.0.200.0030.00718.73
7.0.190.0030.00618.73
7.0.180.0080.00818.73
7.0.170.0060.00318.73
7.0.160.0030.01118.73
7.0.150.0030.00618.73
7.0.140.0000.00918.73
7.0.130.0040.00418.73
7.0.120.0000.00818.73
7.0.110.0090.00018.73
7.0.100.0060.00918.73
7.0.90.0080.00318.73
7.0.80.0050.00518.73
7.0.70.0000.00818.73
7.0.60.0000.01218.73
7.0.50.0000.00818.73
7.0.40.0030.00618.73
7.0.30.0040.00718.73
7.0.20.0030.00518.73
7.0.10.0000.01218.73
7.0.00.0030.00518.73
5.6.300.0030.04520.67
5.6.290.0070.08120.67
5.6.280.0000.05920.86
5.6.270.0090.04121.00
5.6.260.0030.04221.07
5.6.250.0070.04021.09
5.6.240.0070.05220.97
5.6.230.0030.06621.03
5.6.220.0030.04020.96
5.6.210.0100.05921.04
5.6.200.0100.07520.95
5.6.190.0000.07820.81
5.6.180.0030.04620.93
5.6.170.0030.04320.82
5.6.160.0030.04720.85
5.6.150.0030.06620.86
5.6.140.0000.05820.92
5.6.130.0030.04420.88
5.6.120.0100.04620.98
5.6.110.0030.04620.75
5.6.100.0000.04520.82
5.6.90.0030.06220.81
5.6.80.0030.05120.37
5.6.70.0070.03520.29
5.6.60.0030.04220.20
5.6.50.0000.08120.41
5.6.40.0070.03720.22
5.6.30.0000.04220.29
5.6.20.0030.03920.18
5.6.10.0000.04420.27
5.6.00.0000.04420.28
5.5.380.0030.03818.73
5.5.370.0000.05218.73
5.5.360.0030.05118.73
5.5.350.0030.04818.73
5.5.340.0000.08518.73
5.5.330.0000.05418.73
5.5.320.0100.03318.73
5.5.310.0040.03918.73
5.5.300.0000.04218.73
5.5.290.0030.07318.73
5.5.280.0100.04618.73
5.5.270.0060.03918.73
5.5.260.0070.03718.73
5.5.250.0000.04318.73
5.5.240.0030.04218.73
5.5.230.0000.04118.73
5.5.220.0030.03918.73
5.5.210.0070.04018.73
5.5.200.0060.03818.73
5.5.190.0030.03918.73
5.5.180.0000.05218.73
5.5.160.0030.04118.73
5.5.150.0070.03418.73
5.5.140.0000.04018.73
5.5.130.0060.03518.73
5.5.120.0030.03618.73
5.5.110.0030.05518.73
5.5.100.0070.06718.73
5.5.90.0000.04018.73
5.5.80.0060.03218.73
5.5.70.0090.03118.73
5.5.60.0000.04918.73
5.5.50.0030.04718.73
5.5.40.0070.04818.73
5.5.30.0060.03918.73
5.5.20.0000.04718.73
5.5.10.0000.04218.73
5.5.00.0070.03718.73
5.4.450.0070.04319.50
5.4.440.0030.04219.47
5.4.430.0030.04119.31
5.4.420.0030.03919.40
5.4.410.0070.03719.21
5.4.400.0030.05519.14
5.4.390.0000.04719.07
5.4.380.0000.04119.06
5.4.370.0000.04919.16
5.4.360.0030.03819.05
5.4.350.0030.03818.84
5.4.340.0060.07718.83
5.4.320.0000.04819.17
5.4.310.0030.03719.08
5.4.300.0030.03618.88
5.4.290.0100.03018.97
5.4.280.0000.05419.01
5.4.270.0030.05719.04
5.4.260.0000.04119.07
5.4.250.0030.08019.05
5.4.240.0030.03718.82
5.4.230.0030.03718.97
5.4.220.0030.03718.82
5.4.210.0070.04618.93
5.4.200.0070.06018.97
5.4.190.0090.03119.13
5.4.180.0030.03718.98
5.4.170.0030.04319.00
5.4.160.0070.03719.17
5.4.150.0100.05218.98
5.4.140.0030.04718.73
5.4.130.0030.03618.73
5.4.120.0040.03918.73
5.4.110.0000.03918.73
5.4.100.0000.04018.73
5.4.90.0070.03418.73
5.4.80.0030.03618.73
5.4.70.0000.04318.73
5.4.60.0030.05618.73
5.4.50.0040.03318.73
5.4.40.0030.03718.73
5.4.30.0030.04018.73
5.4.20.0260.04518.73
5.4.10.0060.03218.73
5.4.00.0030.03618.73
5.3.290.0070.03318.73
5.3.280.0000.04218.73
5.3.270.0130.05618.73
5.3.260.0000.04018.73
5.3.250.0000.04518.73
5.3.240.0030.03818.73
5.3.230.0000.04518.73
5.3.220.0100.03818.73
5.3.210.0060.03218.73
5.3.200.0030.04618.73
5.3.190.0030.04118.73
5.3.180.0030.03518.73
5.3.170.0000.03918.73
5.3.160.0030.03418.73
5.3.150.0030.03818.73
5.3.140.0030.03618.73
5.3.130.0070.05918.73
5.3.120.0030.03818.73
5.3.110.0000.04918.73
5.3.100.0090.03818.73
5.3.90.0030.03618.73
5.3.80.0040.03618.73
5.3.70.0000.03718.73
5.3.60.0040.03518.73
5.3.50.0040.03518.73
5.3.40.0030.04918.73
5.3.30.0000.04418.73
5.3.20.0030.03218.73
5.3.10.0030.03518.73
5.3.00.0000.04018.73
5.2.170.0000.03318.73
5.2.160.0060.05518.73
5.2.150.0000.03118.73
5.2.140.0000.03118.73
5.2.130.0060.02918.73
5.2.120.0030.02618.73
5.2.110.0000.03018.73
5.2.100.0000.03818.73
5.2.90.0030.03818.73
5.2.80.0060.02818.73
5.2.70.0000.03218.73
5.2.60.0030.02818.73
5.2.50.0030.02818.73
5.2.40.0070.02718.73
5.2.30.0000.03218.73
5.2.20.0030.02618.73
5.2.10.0000.03318.73
5.2.00.0000.03118.73
5.1.60.0030.02218.73
5.1.50.0030.02218.73
5.1.40.0000.02918.73
5.1.30.0000.03118.73
5.1.20.0030.02418.73
5.1.10.0060.02218.73
5.1.00.0060.01918.73
5.0.50.0040.02218.73
5.0.40.0030.02118.73
5.0.30.0000.03218.73
5.0.20.0030.02118.73
5.0.10.0030.03118.73
5.0.00.0000.06818.73
4.4.90.0060.01618.73
4.4.80.0060.01218.73
4.4.70.0060.02618.73
4.4.60.0000.02718.73
4.4.50.0000.02018.73
4.4.40.0030.02318.73
4.4.30.0000.01818.73
4.4.20.0000.01818.73
4.4.10.0070.01118.73
4.4.00.0030.02218.73
4.3.110.0000.01718.73
4.3.100.0000.02418.73
4.3.90.0000.03618.73
4.3.80.0030.03018.73
4.3.70.0070.01718.73
4.3.60.0030.01518.73
4.3.50.0030.01518.73
4.3.40.0000.03018.73
4.3.30.0000.02218.73
4.3.20.0000.01818.73
4.3.10.0000.01718.73
4.3.00.0000.01618.73

preferences:
36.24 ms | 401 KiB | 5 Q