3v4l.org

run code in 300+ PHP versions simultaneously
<?php // CHANGE THIS $url = '/1234/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.0130.00618.45
8.3.50.0160.00222.11
8.3.40.0060.00918.95
8.3.30.0110.00418.79
8.3.20.0080.00018.93
8.3.10.0040.00421.09
8.3.00.0040.00419.55
8.2.180.0130.00716.63
8.2.170.0070.00722.96
8.2.160.0070.00720.34
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0000.00826.16
8.2.120.0080.00021.18
8.2.110.0100.00021.04
8.2.100.0090.00319.89
8.2.90.0000.00819.04
8.2.80.0060.00318.00
8.2.70.0000.00817.86
8.2.60.0040.00418.05
8.2.50.0040.00418.10
8.2.40.0050.00318.34
8.2.30.0040.00421.19
8.2.20.0000.00717.88
8.2.10.0000.00817.88
8.2.00.0000.00817.89
8.1.280.0040.01125.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00622.05
8.1.230.0080.00317.89
8.1.220.0060.00317.78
8.1.210.0060.00318.77
8.1.200.0050.00517.23
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0000.00818.64
8.1.160.0000.00718.80
8.1.150.0000.00818.81
8.1.140.0070.00017.48
8.1.130.0070.00017.88
8.1.120.0030.00617.63
8.1.110.0040.00417.61
8.1.100.0000.00717.64
8.1.90.0030.00417.51
8.1.80.0000.00717.50
8.1.70.0000.00817.51
8.1.60.0040.00417.63
8.1.50.0040.00417.51
8.1.40.0040.00417.68
8.1.30.0000.00817.72
8.1.20.0080.00017.78
8.1.10.0060.00317.70
8.1.00.0040.00417.68
8.0.300.0030.00618.77
8.0.290.0000.00916.88
8.0.280.0000.00718.48
8.0.270.0050.00317.34
8.0.260.0040.00416.99
8.0.250.0020.00517.15
8.0.240.0000.00917.07
8.0.230.0000.00717.13
8.0.220.0000.00817.09
8.0.210.0000.00717.06
8.0.200.0080.00017.02
8.0.190.0040.00417.08
8.0.180.0000.00817.01
8.0.170.0050.00317.02
8.0.160.0030.00517.18
8.0.150.0000.00716.98
8.0.140.0000.01017.11
8.0.130.0030.00313.54
8.0.120.0030.00617.00
8.0.110.0050.00317.16
8.0.100.0050.00317.07
8.0.90.0070.00016.95
8.0.80.0090.01217.11
8.0.70.0020.00517.16
8.0.60.0040.00416.98
8.0.50.0000.00717.18
8.0.30.0130.00617.36
8.0.20.0100.01217.46
8.0.10.0050.00217.21
8.0.00.0180.00416.98
7.4.330.0050.00014.98
7.4.320.0030.00316.79
7.4.300.0070.00016.71
7.4.290.0000.00816.84
7.4.280.0030.00516.80
7.4.270.0040.00416.81
7.4.260.0030.00313.50
7.4.250.0040.00416.80
7.4.240.0000.00716.80
7.4.230.0030.00316.75
7.4.220.0100.00716.75
7.4.210.0060.00916.80
7.4.200.0040.00416.83
7.4.190.0000.00716.97
7.4.160.0100.00616.61
7.4.150.0060.01217.40
7.4.140.0080.00917.86
7.4.130.0090.00916.83
7.4.120.0110.00616.81
7.4.110.0070.01116.61
7.4.100.0040.01316.68
7.4.90.0070.01116.82
7.4.80.0150.00619.39
7.4.70.0070.01016.72
7.4.60.0090.00916.74
7.4.50.0080.00016.67
7.4.40.0000.01622.77
7.4.30.0070.01116.80
7.4.10.0140.00315.04
7.4.00.0110.00715.24
7.3.330.0050.00013.27
7.3.320.0000.00713.32
7.3.310.0030.00316.28
7.3.300.0030.00316.51
7.3.290.0080.00616.49
7.3.280.0110.00716.49
7.3.270.0090.01217.40
7.3.260.0140.00918.24
7.3.250.0130.00616.81
7.3.240.0110.00616.58
7.3.230.0070.01116.59
7.3.210.0060.01116.88
7.3.200.0060.01319.39
7.3.190.0030.01316.46
7.3.180.0100.00616.53
7.3.170.0120.00916.63
7.3.160.0060.00916.89
7.3.130.0040.01414.99
7.3.120.0090.00815.25
7.3.110.0050.01415.17
7.3.100.0060.01015.04
7.3.90.0060.00514.71
7.3.80.0020.00914.97
7.3.70.0020.01215.01
7.3.60.0070.00814.88
7.3.50.0090.00814.97
7.3.40.0100.00314.99
7.3.30.0040.00714.91
7.3.20.0030.01216.75
7.3.10.0070.00616.82
7.3.00.0050.00716.87
7.2.330.0120.00617.02
7.2.320.0150.00916.71
7.2.310.0120.00617.00
7.2.300.0090.00716.84
7.2.290.0130.00316.77
7.2.260.0070.01114.96
7.2.250.0120.00815.18
7.2.240.0040.01415.25
7.2.230.0030.01015.19
7.2.220.0060.00815.15
7.2.210.0080.00615.38
7.2.200.0060.00714.95
7.2.190.0050.00615.08
7.2.180.0060.00815.32
7.2.170.0100.00215.14
7.2.160.0000.01415.13
7.2.150.0040.00416.72
7.2.140.0100.00717.06
7.2.130.0060.00717.12
7.2.120.0080.00417.06
7.2.110.0080.00517.10
7.2.100.0050.00817.12
7.2.90.0040.00917.09
7.2.80.0110.00817.09
7.2.70.0040.01017.08
7.2.60.0040.01017.08
7.2.50.0050.00916.94
7.2.40.0070.00616.99
7.2.30.0070.00717.20
7.2.20.0070.00917.06
7.2.10.0090.00417.16
7.2.00.0050.00717.55
7.1.330.0050.01016.21
7.1.320.0110.00516.09
7.1.310.0080.00316.13
7.1.300.0030.01215.88
7.1.290.0070.00515.93
7.1.280.0050.00515.84
7.1.270.0080.00315.87
7.1.260.0030.00915.91
7.1.250.0070.00416.00
7.1.240.0070.00716.15
7.1.230.0030.00715.58
7.1.220.0040.00715.98
7.1.210.0080.00815.92
7.1.200.0040.00916.08
7.1.190.0080.00015.70
7.1.180.0040.01115.99
7.1.170.0030.00715.89
7.1.160.0070.01116.08
7.1.150.0000.01515.88
7.1.140.0040.01115.89
7.1.130.0080.00015.83
7.1.120.0000.01015.75
7.1.110.0050.00415.81
7.1.100.0040.00617.17
7.1.90.0080.00616.14
7.1.80.0000.01115.81
7.1.70.0070.00416.70
7.1.60.0050.00416.75
7.1.50.0050.00716.76
7.1.40.0000.01216.63
7.1.30.0000.01116.73
7.1.20.0060.00616.77
7.1.10.0050.00516.71
7.1.00.0050.00616.65
7.0.330.0030.00615.54
7.0.320.0100.00315.66
7.0.310.0030.01015.61
7.0.300.0060.00615.60
7.0.290.0040.01115.62
7.0.280.0040.01215.58
7.0.270.0030.01215.59
7.0.260.0070.00315.44
7.0.250.0030.00915.50
7.0.240.0110.00315.56
7.0.230.0040.00415.67
7.0.220.0040.00715.33
7.0.210.0080.00415.41
7.0.200.0050.00716.44
7.0.190.0050.00516.48
7.0.180.0020.00916.54
7.0.170.0040.00616.49
7.0.160.0010.00916.37
7.0.150.0050.00816.50
7.0.140.0090.00316.36
7.0.130.0070.00616.50
7.0.120.0050.00716.56
7.0.110.0050.00516.52
7.0.100.0030.00716.48
7.0.90.0050.00416.53
7.0.80.0040.01116.51
7.0.70.0000.01116.43
7.0.60.0060.00716.60
7.0.50.0000.00916.56
7.0.40.0070.00515.52
7.0.30.0040.00715.54
7.0.20.0060.00415.53
7.0.10.0080.00415.46
7.0.00.0070.00415.41
5.6.400.0030.01014.18
5.6.390.0030.00714.06
5.6.380.0040.00414.67
5.6.370.0030.00914.15
5.6.360.0110.00314.66
5.6.350.0060.01114.31
5.6.340.0050.00514.06
5.6.330.0000.00914.78
5.6.320.0060.00914.66
5.6.310.0030.01314.40
5.6.300.0080.03517.55
5.6.290.0030.02717.67
5.6.280.0090.02217.72
5.6.270.0020.02917.72
5.6.260.0050.02917.76
5.6.250.0060.02517.75
5.6.240.0040.03317.57
5.6.230.0070.02517.65
5.6.220.0020.02417.62
5.6.210.0050.02717.56
5.6.200.0020.03317.53
5.6.190.0080.04317.69
5.6.180.0070.02417.65
5.6.170.0050.03017.75
5.6.160.0070.02417.63
5.6.150.0070.02617.58
5.6.140.0020.02817.78
5.6.130.0080.02917.75
5.6.120.0070.02317.57
5.6.110.0020.02917.52
5.6.100.0020.03917.52
5.6.90.0020.02717.57
5.6.80.0070.02417.34
5.6.70.0050.02517.28
5.6.60.0030.02317.37
5.6.50.0030.02417.25
5.6.40.0050.02417.31
5.6.30.0040.02317.31
5.6.20.0000.02817.21
5.6.10.0050.02017.38
5.6.00.0060.03317.22
5.5.380.0060.02215.86
5.5.370.0070.03415.94
5.5.360.0050.02415.86
5.5.350.0050.02216.06
5.5.340.0080.03916.09
5.5.330.0050.02616.20
5.5.320.0050.02316.14
5.5.310.0080.03116.28
5.5.300.0020.02516.02
5.5.290.0050.02415.98
5.5.280.0050.02516.18
5.5.270.0020.03016.01
5.5.260.0030.02716.08
5.5.250.0070.02116.15
5.5.240.0040.03315.92
5.5.230.0050.02415.70
5.5.220.0050.02315.93
5.5.210.0050.02715.82
5.5.200.0020.02715.86
5.5.190.0020.02815.88
5.5.180.0050.02515.87
5.5.170.0060.00914.29
5.5.160.0070.04115.89
5.5.150.0020.03215.82
5.5.140.0030.04415.83
5.5.130.0090.03615.81
5.5.120.0050.03215.92
5.5.110.0050.03415.73
5.5.100.0050.02515.70
5.5.90.0030.02515.75
5.5.80.0050.02715.85
5.5.70.0030.02615.90
5.5.60.0060.04115.90
5.5.50.0080.02015.83
5.5.40.0130.02115.85
5.5.30.0060.02315.82
5.5.20.0020.02615.77
5.5.10.0000.02815.82
5.5.00.0050.02415.91
5.4.450.0030.02915.27
5.4.440.0050.02615.05
5.4.430.0020.02515.31
5.4.420.0040.03115.35
5.4.410.0050.02215.20
5.4.400.0030.01915.00
5.4.390.0040.02214.99
5.4.380.0080.02615.00
5.4.370.0030.02115.01
5.4.360.0040.02215.09
5.4.350.0020.02614.92
5.4.340.0030.02215.05
5.4.330.0060.00311.13
5.4.320.0030.02415.09
5.4.310.0020.02815.00
5.4.300.0040.04215.07
5.4.290.0020.03514.99
5.4.280.0050.02215.14
5.4.270.0030.02415.01
5.4.260.0190.02115.08
5.4.250.0060.02015.03
5.4.240.0050.02215.04
5.4.230.0020.03315.02
5.4.220.0020.02915.05
5.4.210.0080.02815.01
5.4.200.0020.02715.03
5.4.190.0060.02515.02
5.4.180.0090.01915.10
5.4.170.0050.04114.97
5.4.160.0070.03814.99
5.4.150.0060.02515.01
5.4.140.0030.02114.25
5.4.130.0040.02814.22
5.4.120.0000.02614.20
5.4.110.0020.02314.06
5.4.100.0060.02014.20
5.4.90.0110.02414.15
5.4.80.0060.01914.19
5.4.70.0020.02314.27
5.4.60.0020.02514.27
5.4.50.0030.03914.22
5.4.40.0070.03214.22
5.4.30.0040.03614.32
5.4.20.0070.01714.12
5.4.10.0030.02314.07
5.4.00.0020.02214.12
5.3.290.0030.02513.88
5.3.280.0030.03613.85
5.3.270.0030.02913.85
5.3.260.0020.02513.85
5.3.250.0040.02413.85
5.3.240.0020.02413.85
5.3.230.0060.01913.85
5.3.220.0030.02513.85
5.3.210.0050.02313.85
5.3.200.0050.02413.85
5.3.190.0000.02813.85
5.3.180.0070.02213.90
5.3.170.0020.02413.85
5.3.160.0050.02113.85
5.3.150.0070.02413.91
5.3.140.0050.02213.85
5.3.130.0040.02613.85
5.3.120.0040.01913.85
5.3.110.0060.02113.85
5.3.100.0010.02413.85
5.3.90.0000.02913.86
5.3.80.0050.02013.85
5.3.70.0070.03313.85
5.3.60.0030.04113.85
5.3.50.0040.02113.85
5.3.40.0030.02313.85
5.3.30.0090.02213.85
5.3.20.0030.02213.85
5.3.10.0050.02013.85
5.3.00.0040.01813.85
5.2.170.0030.05317.40
5.2.160.0000.03617.40
5.2.150.0130.03017.40
5.2.140.0030.03117.40
5.2.130.0000.03617.40
5.2.120.0000.03417.40
5.2.110.0040.02617.40
5.2.100.0100.02917.40
5.2.90.0000.02917.40
5.2.80.0000.03517.40
5.2.70.0000.06217.40
5.2.60.0000.03517.40
5.2.50.0030.02917.40
5.2.40.0040.03017.40
5.2.30.0030.03217.40
5.2.20.0170.03717.40
5.2.10.0030.02917.40
5.2.00.0000.03417.40
5.1.60.0030.02717.40
5.1.50.0060.02217.40
5.1.40.0030.02317.40
5.1.30.0030.02717.40
5.1.20.0030.02917.40
5.1.10.0220.02917.40
5.1.00.0030.02417.40
5.0.50.0030.02217.40
5.0.40.0000.02517.40
5.0.30.0000.03517.40
5.0.20.0060.01617.40
5.0.10.0030.02217.40
5.0.00.0070.02617.40
4.4.90.0060.01617.40
4.4.80.0030.01317.40
4.4.70.0060.01217.40
4.4.60.0060.01117.40
4.4.50.0000.01717.40
4.4.40.0040.02217.40
4.4.30.0000.01717.40
4.4.20.0030.01517.40
4.4.10.0000.01717.40
4.4.00.0000.02817.40
4.3.110.0000.01717.40
4.3.100.0040.01217.40
4.3.90.0090.01317.40
4.3.80.0000.02417.40
4.3.70.0000.01517.40
4.3.60.0000.01617.40
4.3.50.0000.01617.40
4.3.40.0030.03017.40
4.3.30.0000.02017.40
4.3.20.0030.02917.40
4.3.10.0070.01417.40
4.3.00.0060.01217.40

preferences:
42.87 ms | 401 KiB | 5 Q