3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/mr/products'; $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.40.0140.00018.96
8.3.30.0110.00318.96
8.3.20.0030.00519.07
8.3.10.0000.00821.01
8.3.00.0030.00619.68
8.2.170.0090.00622.96
8.2.160.0000.01420.43
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.21
8.2.110.0030.00622.38
8.2.100.0060.00618.16
8.2.90.0080.00019.22
8.2.80.0040.00417.97
8.2.70.0000.00918.00
8.2.60.0040.00417.91
8.2.50.0080.00018.07
8.2.40.0050.00318.22
8.2.30.0040.00421.41
8.2.20.0050.00317.95
8.2.10.0030.00618.11
8.2.00.0050.00317.85
8.1.270.0090.00623.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00022.02
8.1.230.0050.00620.73
8.1.220.0050.00317.77
8.1.210.0030.00518.77
8.1.200.0040.00717.35
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0040.00418.49
8.1.160.0000.00718.84
8.1.150.0040.00418.75
8.1.140.0040.00417.66
8.1.130.0000.00719.39
8.1.120.0000.00817.63
8.1.110.0000.00817.63
8.1.100.0040.00417.60
8.1.90.0040.00417.64
8.1.80.0040.00417.57
8.1.70.0030.00317.57
8.1.60.0040.00417.76
8.1.50.0000.00817.58
8.1.40.0000.00817.61
8.1.30.0080.00017.82
8.1.20.0090.00017.80
8.1.10.0030.00617.62
8.1.00.0050.00317.67
8.0.300.0040.00419.77
8.0.290.0080.00017.00
8.0.280.0030.00318.36
8.0.270.0040.00417.20
8.0.260.0000.00717.03
8.0.250.0040.00417.24
8.0.240.0050.00317.23
8.0.230.0000.00817.19
8.0.220.0030.00317.08
8.0.210.0070.00017.14
8.0.200.0000.00717.10
8.0.190.0030.00517.21
8.0.180.0040.00416.99
8.0.170.0000.00717.11
8.0.160.0050.00317.07
8.0.150.0000.00717.03
8.0.140.0060.00317.04
8.0.130.0000.00613.50
8.0.120.0040.00416.96
8.0.110.0040.00417.11
8.0.100.0070.00017.11
8.0.90.0000.00717.01
8.0.80.0160.00617.14
8.0.70.0070.00017.23
8.0.60.0050.00217.00
8.0.50.0000.00817.08
8.0.30.0090.01017.41
8.0.20.0110.01017.40
8.0.10.0000.00717.29
8.0.00.0090.01316.79
7.4.330.0030.00316.77
7.4.320.0060.00016.79
7.4.300.0040.00416.63
7.4.290.0030.00316.80
7.4.280.0030.00316.75
7.4.270.0000.00716.82
7.4.260.0030.00313.50
7.4.250.0030.00616.74
7.4.240.0030.00316.86
7.4.230.0030.00316.80
7.4.220.0120.00316.59
7.4.210.0060.01016.77
7.4.200.0080.00016.93
7.4.190.0000.00816.82
7.4.160.0110.01116.89
7.4.150.0130.01017.40
7.4.140.0110.00617.86
7.4.130.0100.01316.67
7.4.120.0100.00816.74
7.4.110.0100.01016.63
7.4.100.0080.01216.52
7.4.90.0130.00716.72
7.4.80.0130.01019.39
7.4.70.0030.01416.71
7.4.60.0100.00716.73
7.4.50.0000.00816.77
7.4.40.0070.01022.77
7.4.30.0050.01216.76
7.4.00.0050.00814.98
7.3.330.0000.00513.32
7.3.320.0030.00313.47
7.3.310.0030.00316.65
7.3.300.0030.00316.48
7.3.290.0060.00916.54
7.3.280.0120.00516.53
7.3.270.0080.00817.40
7.3.260.0100.00818.24
7.3.250.0160.00216.72
7.3.240.0130.00316.53
7.3.230.0150.00416.77
7.3.210.0030.01316.59
7.3.200.0190.00019.39
7.3.190.0090.00816.73
7.3.180.0100.01016.49
7.3.170.0220.00016.82
7.3.160.0030.01316.55
7.3.120.0100.00615.00
7.2.330.0120.00816.70
7.2.320.0060.01416.92
7.2.310.0100.01016.87
7.2.300.0140.00716.94
7.2.290.0080.00816.89
7.1.70.0130.00317.58
7.1.60.0070.01317.43
7.1.50.0160.01017.23
7.1.40.0110.00416.87
7.1.30.0080.00816.97
7.1.20.0070.01316.93
7.1.10.0100.00516.91
7.1.00.0060.00616.92
7.0.200.0070.01116.93
7.0.190.0100.01316.74
7.0.180.0070.00716.46
7.0.170.0060.00616.43
7.0.160.0080.00816.50
7.0.150.0090.01416.49
7.0.140.0070.01116.52
7.0.130.0040.00816.75
7.0.120.0040.00816.84
7.0.110.0060.00616.61
7.0.100.0100.00316.59
7.0.90.0110.00016.66
7.0.80.0060.00616.66
7.0.70.0060.00616.58
7.0.60.0040.00816.48
7.0.50.0060.00616.57
7.0.40.0000.01814.80
7.0.30.0000.01614.59
7.0.20.0000.01414.64
7.0.10.0040.00714.66
7.0.00.0000.00814.51
5.6.300.0100.03820.57
5.6.290.0000.04420.57
5.6.280.0030.05220.81
5.6.270.0070.04120.97
5.6.260.0000.04620.94
5.6.250.0030.03920.84
5.6.240.0100.03520.99
5.6.230.0000.04920.88
5.6.220.0000.04420.75
5.6.210.0000.04620.98
5.6.200.0070.04220.91
5.6.190.0070.05620.77
5.6.180.0100.04220.78
5.6.170.0030.04020.80
5.6.160.0030.04320.77
5.6.150.0070.04320.87
5.6.140.0030.06220.89
5.6.130.0000.04420.78
5.6.120.0000.05820.91
5.6.110.0030.04320.89
5.6.100.0000.04420.93
5.6.90.0030.04320.94
5.6.80.0000.06120.30
5.6.70.0070.03420.18
5.6.60.0030.04420.17
5.6.50.0000.04220.19
5.6.40.0000.05220.27
5.6.30.0070.03620.04
5.6.20.0070.03520.24
5.6.10.0030.04720.11
5.6.00.0070.03620.21
5.5.380.0030.04417.46
5.5.370.0060.03717.51
5.5.360.0070.04517.39
5.5.350.0030.06217.45
5.5.340.0000.04517.94
5.5.330.0060.07418.03
5.5.320.0000.04518.08
5.5.310.0000.04618.05
5.5.300.0030.04018.06
5.5.290.0240.04418.06
5.5.280.0060.04318.06
5.5.270.0070.04317.92
5.5.260.0030.04517.93
5.5.250.0090.03717.93
5.5.240.0070.04017.45
5.5.230.0000.04717.45
5.5.220.0030.04417.40
5.5.210.0120.05017.43
5.5.200.0030.07217.22
5.5.190.0030.03917.05
5.5.180.0040.05717.31
5.5.160.0060.03417.05
5.5.150.0030.03917.09
5.5.140.0000.08917.36
5.5.130.0060.03817.41
5.5.120.0100.04217.28
5.5.110.0090.03117.04
5.5.100.0070.04317.19
5.5.90.0060.04117.28
5.5.80.0100.04317.27
5.5.70.0070.03617.24
5.5.60.0030.03817.31
5.5.50.0030.05117.18
5.5.40.0130.06016.98
5.5.30.0030.03817.26
5.5.20.0070.03916.98
5.5.10.0030.07117.30
5.5.00.0030.04117.29
5.4.450.0070.04719.37
5.4.440.0040.04819.25
5.4.430.0030.04219.15
5.4.420.0060.03919.39
5.4.410.0000.04219.08
5.4.400.0000.04218.83
5.4.390.0000.04118.91
5.4.380.0070.03419.02
5.4.370.0070.07818.88
5.4.360.0070.07319.07
5.4.350.0030.03819.04
5.4.340.0070.04719.09
5.4.320.0100.03819.16
5.4.310.0070.03419.00
5.4.300.0070.05519.09
5.4.290.0070.03419.17
5.4.280.0000.05419.00
5.4.270.0070.03518.82
5.4.260.0040.04419.13
5.4.250.0100.06319.09
5.4.240.0000.04118.90
5.4.230.0070.03719.05
5.4.220.0000.05219.04
5.4.210.0070.04119.02
5.4.200.0030.04018.98
5.4.190.0070.07319.00
5.4.180.0030.04019.07
5.4.170.0030.04819.10
5.4.160.0000.04118.96
5.4.150.0100.03618.89
5.4.140.0060.04216.65
5.4.130.0060.03516.57
5.4.120.0030.03616.66
5.4.110.0060.03816.63
5.4.100.0090.03016.55
5.4.90.0030.03516.51
5.4.80.0000.04516.72
5.4.70.0030.04916.40
5.4.60.0000.03716.34
5.4.50.0000.03916.58
5.4.40.0030.04016.65
5.4.30.0000.04216.32
5.4.20.0040.04316.61
5.4.10.0060.04116.39
5.4.00.0030.04215.92
5.3.290.0070.03714.80
5.3.280.0070.03314.75
5.3.270.0070.03814.66
5.3.260.0000.04814.78
5.3.250.0060.06014.76
5.3.240.0030.04214.60
5.3.230.0150.03014.51
5.3.220.0000.04214.51
5.3.210.0000.04114.55
5.3.200.0100.04614.55
5.3.190.0060.03614.63
5.3.180.0060.03314.67
5.3.170.0000.04314.55
5.3.160.0000.04314.51
5.3.150.0090.04114.61
5.3.140.0030.04714.78
5.3.130.0000.04514.52
5.3.120.0030.04214.54
5.3.110.0100.04014.70
5.3.100.0000.04214.51
5.3.90.0030.04214.51
5.3.80.0040.03514.51
5.3.70.0000.04014.51
5.3.60.0030.03714.51
5.3.50.0100.03214.51
5.3.40.0030.03514.51
5.3.30.0030.03514.51
5.3.20.0030.03514.51
5.3.10.0030.04114.51
5.3.00.0060.04214.51
5.2.170.0060.03014.51
5.2.160.0000.03414.51
5.2.150.0040.03014.51
5.2.140.0000.03414.51
5.2.130.0060.02914.51
5.2.120.0030.03114.51
5.2.110.0030.03014.51
5.2.100.0040.03014.51
5.2.90.0000.03214.51
5.2.80.0000.03814.51
5.2.70.0030.03314.51
5.2.60.0000.03314.51
5.2.50.0040.03014.51
5.2.40.0030.03014.51
5.2.30.0000.03814.51
5.2.20.0000.03014.51
5.2.10.0000.03014.51
5.2.00.0000.03314.51
5.1.60.0000.03014.51
5.1.50.0030.02814.51
5.1.40.0040.02514.51
5.1.30.0040.02714.51
5.1.20.0000.02814.51
5.1.10.0090.02414.51
5.1.00.0040.03514.51
5.0.50.0030.02014.51
5.0.40.0030.02314.51
5.0.30.0030.02914.51
5.0.20.0030.02114.51
5.0.10.0000.02214.51
5.0.00.0030.03014.51
4.4.90.0070.01714.51
4.4.80.0040.01814.51
4.4.70.0060.01614.51
4.4.60.0030.01314.51
4.4.50.0030.01314.51
4.4.40.0000.02614.51
4.4.30.0040.01414.51
4.4.20.0060.02414.51
4.4.10.0030.01314.51
4.4.00.0030.02414.51
4.3.110.0000.01814.51
4.3.100.0000.01814.51
4.3.90.0000.01714.51
4.3.80.0030.02414.51
4.3.70.0000.01814.51
4.3.60.0060.01114.51
4.3.50.0040.01914.51
4.3.40.0030.02414.51
4.3.30.0030.01714.51
4.3.20.0110.01114.51
4.3.10.0030.01814.51
4.3.00.0030.01914.51

preferences:
31.89 ms | 400 KiB | 5 Q