3v4l.org

run code in 300+ PHP versions simultaneously
<?php $routes = [ 'primary' => [ 'pattern' => '#/(?P<resource>[^/\\\\.,;?\n]+)/foobar#', 'default' => [ 'action' => 'standard', ], ], 'secundary' => [ 'pattern' => '#^(?:/(?P<resource>[^/\\\\.,;?\n]+)(?:/(?P<action>[^/\\\\.,;?\n0-9]+))?(?:/(?P<id>[0-9]+))?)?$#', 'default' => [ 'resource' => 'catalog', 'action' => 'view', ] ], 'fallback' => [ 'pattern' => '#^.*$#', 'default' => [ 'resource' => 'main', 'action' => 'landing', ], ], ]; $url = '/foobar/12345'; $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] ); } } 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.0070.01418.56
8.3.50.0100.00522.20
8.3.40.0120.00318.80
8.3.30.0150.00018.98
8.3.20.0070.00020.34
8.3.10.0000.00723.69
8.3.00.0030.00620.77
8.2.180.0100.01016.75
8.2.170.0110.00422.96
8.2.160.0140.00420.35
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.40
8.2.110.0070.00320.53
8.2.100.0060.00618.03
8.2.90.0100.00017.87
8.2.80.0000.00818.00
8.2.70.0040.00418.05
8.2.60.0030.00618.34
8.2.50.0080.00018.16
8.2.40.0040.00419.28
8.2.30.0000.00819.32
8.2.20.0030.00617.84
8.2.10.0060.00318.14
8.2.00.0080.00019.79
8.1.280.0040.01125.92
8.1.270.0030.00623.79
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0180.00422.57
8.1.230.0080.00420.95
8.1.220.0060.00317.77
8.1.210.0000.00818.77
8.1.200.0200.00317.22
8.1.190.0100.00017.35
8.1.180.0030.00518.10
8.1.170.0090.00018.71
8.1.160.0000.00718.99
8.1.150.0000.00718.81
8.1.140.0000.00917.64
8.1.130.0030.00317.86
8.1.120.0040.00417.66
8.1.110.0000.00817.54
8.1.100.0080.00017.60
8.1.90.0040.00417.65
8.1.80.0000.00717.52
8.1.70.0000.00717.61
8.1.60.0000.00817.77
8.1.50.0000.00817.67
8.1.40.0000.00817.68
8.1.30.0000.00917.68
8.1.20.0030.00517.85
8.1.10.0050.00217.75
8.1.00.0070.00317.50
8.0.300.0000.00819.98
8.0.290.0000.00716.75
8.0.280.0000.00718.54
8.0.270.0040.00417.05
8.0.260.0070.00017.29
8.0.250.0070.00017.20
8.0.240.0030.00517.06
8.0.230.0030.00317.19
8.0.220.0070.00017.13
8.0.210.0080.00017.06
8.0.200.0000.00617.13
8.0.190.0000.00817.09
8.0.180.0040.00417.02
8.0.170.0030.00617.13
8.0.160.0040.00417.07
8.0.150.0050.00317.13
8.0.140.0000.00716.97
8.0.130.0000.00513.57
8.0.120.0040.00416.96
8.0.110.0060.00317.16
8.0.100.0000.00717.11
8.0.90.0040.00417.13
8.0.80.0100.01317.09
8.0.70.0040.00417.07
8.0.60.0040.00417.18
8.0.50.0040.00416.98
8.0.30.0090.01017.08
8.0.20.0120.00617.40
8.0.10.0000.00817.09
8.0.00.0090.01216.82
7.4.330.0000.00515.16
7.4.320.0030.00316.82
7.4.300.0000.00616.71
7.4.290.0030.00316.84
7.4.280.0040.00416.61
7.4.270.0000.00716.83
7.4.260.0000.00716.60
7.4.250.0040.00416.79
7.4.240.0020.00716.79
7.4.230.0040.00416.48
7.4.220.0030.01516.70
7.4.210.0060.00916.91
7.4.200.0000.00716.59
7.4.160.0110.00616.80
7.4.150.0110.00717.40
7.4.140.0040.01317.86
7.4.130.0100.00816.76
7.4.120.0100.01116.67
7.4.110.0090.00916.61
7.4.100.0070.01116.65
7.4.90.0070.01016.70
7.4.80.0090.01219.39
7.4.70.0110.00716.78
7.4.60.0070.01016.67
7.4.50.0030.00516.80
7.4.40.0200.00316.59
7.4.30.0070.01016.47
7.4.00.0070.00415.11
7.3.330.0000.00613.28
7.3.320.0050.00013.37
7.3.310.0030.00316.45
7.3.300.0030.00316.49
7.3.290.0040.01116.49
7.3.280.0070.01216.54
7.3.270.0080.01117.40
7.3.260.0030.01716.50
7.3.250.0090.01016.63
7.3.240.0140.01116.74
7.3.230.0040.01316.52
7.3.210.0140.00316.40
7.3.200.0080.00819.39
7.3.190.0180.00316.90
7.3.180.0150.01116.83
7.3.170.0080.00816.55
7.3.160.0090.00616.59
7.3.120.0030.01215.08
7.2.330.0090.00916.88
7.2.320.0100.00616.86
7.2.310.0110.00616.69
7.2.300.0120.00616.69
7.2.290.0000.01716.95
7.2.60.0060.00616.89
7.2.00.0040.01119.72
7.1.200.0100.00315.85
7.1.100.0080.00818.58
7.1.70.0000.00917.55
7.1.60.0090.01619.70
7.1.50.0190.01034.76
7.1.00.0000.08022.30
7.0.200.0210.01114.97
7.0.140.0070.07322.18
7.0.70.0070.04321.71
7.0.60.0000.09021.79
7.0.50.0070.08722.09
7.0.40.0070.08320.15
7.0.30.0070.06020.11
7.0.20.0030.08020.18
7.0.10.0070.07720.17
7.0.00.0000.05020.09
5.6.280.0100.06721.07
5.6.220.0000.09020.64
5.6.210.0030.08320.64
5.6.200.0070.05721.04
5.6.190.0070.08020.96
5.6.180.0100.05021.02
5.6.170.0070.07020.96
5.6.160.0000.08721.04
5.6.150.0200.05021.17
5.6.140.0030.04721.10
5.6.130.0000.08321.04
5.6.120.0000.05320.93
5.6.110.0070.04321.09
5.6.100.0030.08321.04
5.6.90.0030.05021.09
5.6.80.0130.04020.40
5.6.70.0000.08720.37
5.6.60.0070.06020.41
5.6.50.0000.08720.46
5.6.40.0100.03720.46
5.6.30.0000.05720.39
5.6.20.0100.07020.38
5.6.10.0100.08320.39
5.6.00.0030.08020.29
5.5.360.0030.08020.36
5.5.350.0100.08320.38
5.5.340.0030.08320.86
5.5.330.0170.06720.80
5.5.320.0030.08020.86
5.5.310.0000.08020.77
5.5.300.0030.08020.93
5.5.290.0030.08720.76
5.5.280.0030.08720.92
5.5.270.0070.04020.63
5.5.260.0070.08020.63
5.5.250.0030.08720.74
5.5.240.0030.08320.18
5.5.230.0070.07720.29
5.5.220.0030.07020.23
5.5.210.0000.08020.26
5.5.200.0100.07720.24
5.5.190.0030.07720.14
5.5.180.0030.07020.18
5.5.160.0070.08020.14
5.5.150.0000.06320.23
5.5.140.0030.04720.11
5.5.130.0100.08020.25
5.5.120.0100.07720.09
5.5.110.0030.06320.25
5.5.100.0030.08020.17
5.5.90.0030.08320.12
5.5.80.0000.07319.97
5.5.70.0070.07320.05
5.5.60.0070.04720.14
5.5.50.0000.05019.93
5.5.40.0030.07720.05
5.5.30.0070.07320.14
5.5.20.0070.06020.02
5.5.10.0030.08020.03
5.5.00.0030.04320.09
5.4.450.0030.07319.29
5.4.440.0070.04019.29
5.4.430.0030.08019.39
5.4.420.0070.06319.46
5.4.410.0030.08019.22
5.4.400.0030.08019.04
5.4.390.0030.04718.90
5.4.380.0070.07318.95
5.4.370.0030.06318.98
5.4.360.0000.04319.04
5.4.350.0030.06018.98
5.4.340.0070.07718.90
5.4.320.0030.08319.12
5.4.310.0070.06719.12
5.4.300.0070.07018.97
5.4.290.0030.08018.96
5.4.280.0000.08719.12
5.4.270.0130.06718.98
5.4.260.0100.07318.80
5.4.250.0070.06719.04
5.4.240.0070.07018.78
5.4.230.0070.07318.80
5.4.220.0030.05319.11
5.4.210.0100.04018.89
5.4.200.0030.04319.09
5.4.190.0030.07719.03
5.4.180.0070.07319.01
5.4.170.0000.08019.09
5.4.160.0030.07719.04
5.4.150.0030.05318.98
5.4.140.0000.08316.38
5.4.130.0030.05716.32
5.4.120.0030.07016.33
5.4.110.0030.07716.31
5.4.100.0030.07716.46
5.4.90.0030.07316.27
5.4.80.0030.05016.34
5.4.70.0070.07016.30
5.4.60.0070.07016.23
5.4.50.0030.06716.18
5.4.40.0030.07716.32
5.4.30.0030.06316.27
5.4.20.0070.05316.38
5.4.10.0130.07016.33
5.4.00.0030.06015.71
5.3.290.0030.07714.53
5.3.280.0100.05314.50
5.3.270.0000.05314.44
5.3.260.0000.05714.55
5.3.250.0070.07714.46
5.3.240.0000.07314.47
5.3.230.0100.05014.56
5.3.220.0000.07714.55
5.3.210.0030.07714.39
5.3.200.0000.07714.57
5.3.190.0000.06314.56
5.3.180.0000.07714.56
5.3.170.0030.07714.52
5.3.160.0070.07314.50
5.3.150.0100.06014.56
5.3.140.0030.07314.52
5.3.130.0070.06314.51
5.3.120.0030.08314.55
5.3.110.0100.07014.38
5.3.100.0070.07314.05
5.3.90.0100.06713.84
5.3.80.0070.06014.01
5.3.70.0000.06713.97
5.3.60.0000.05713.96
5.3.50.0000.05013.80
5.3.40.0100.06713.89
5.3.30.0070.07313.77
5.3.20.0030.07313.63
5.3.10.0030.07013.52
5.3.00.0030.07013.59
5.2.170.0030.04012.31
5.2.160.0000.04012.31
5.2.150.0030.06312.31
5.2.140.0030.04012.31
5.2.130.0030.05012.31
5.2.120.0000.06312.31
5.2.110.0000.05312.31
5.2.100.0030.05712.31
5.2.90.0000.06012.31
5.2.80.0030.06012.31
5.2.70.0000.05312.31
5.2.60.0000.05712.31
5.2.50.0000.06312.31
5.2.40.0030.05012.31
5.2.30.0030.04712.31
5.2.20.0000.06712.31
5.2.10.0030.05712.31
5.2.00.0030.05712.31
5.1.60.0070.04712.31
5.1.50.0030.05312.31
5.1.40.0000.03712.31
5.1.30.0000.03012.31
5.1.20.0030.05312.31
5.1.10.0000.05712.31
5.1.00.0070.05012.31
5.0.50.0000.04312.31
5.0.40.0000.03712.31
5.0.30.0070.05712.31
5.0.20.0000.04312.31
5.0.10.0030.03312.31
5.0.00.0000.04712.31
4.4.90.0000.02712.31
4.4.80.0070.03012.31
4.4.70.0030.03312.31
4.4.60.0000.03712.31
4.4.50.0030.03312.31
4.4.40.0000.04712.31
4.4.30.0070.02712.31
4.4.20.0030.02012.31
4.4.10.0000.03712.31
4.4.00.0000.05712.31
4.3.110.0030.03712.31
4.3.100.0030.03312.31
4.3.90.0000.03312.31
4.3.80.0000.05312.31
4.3.70.0000.03312.31
4.3.60.0000.02712.31
4.3.50.0030.03012.31
4.3.40.0070.04712.31
4.3.30.0000.03012.31
4.3.20.0030.03712.31
4.3.10.0000.02312.31
4.3.00.0030.04012.31

preferences:
56.62 ms | 400 KiB | 5 Q