3v4l.org

run code in 300+ PHP versions simultaneously
<?php function routedispatch_preg($path, $patterns) { foreach ($patterns as $pattern) { if (preg_match($pattern[0], $path)) { return $pattern[1](); } } } function foo() { var_dump('foo dispatched.'); } function bar() { var_dump('bar dispatched.'); } $path = '/news/123'; $patterns = [ 'news' => ['#^/news/?$#', 'foo'], 'newsid' => ['#^/news/(\d+)$#', 'bar'] ]; routedispatch_preg($path, $patterns);

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.0090.00916.75
8.3.50.0040.01116.64
8.3.40.0170.00319.01
8.3.30.0070.00719.02
8.3.20.0040.00420.16
8.3.10.0000.00823.66
8.3.00.0000.00823.50
8.2.180.0090.00616.63
8.2.170.0120.00319.11
8.2.160.0070.00722.96
8.2.150.0030.00525.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00420.02
8.2.110.0080.00422.23
8.2.100.0120.00417.89
8.2.90.0080.00318.16
8.2.80.0060.00318.05
8.2.70.0030.00518.03
8.2.60.0000.00818.09
8.2.50.0050.00318.22
8.2.40.0000.00820.29
8.2.30.0040.00419.24
8.2.20.0060.00318.20
8.2.10.0080.00017.95
8.2.00.0000.00818.13
8.1.280.0090.00625.92
8.1.270.0080.00023.90
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0080.00022.14
8.1.230.0040.00720.74
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0000.01017.38
8.1.190.0000.00917.23
8.1.180.0050.00318.10
8.1.170.0080.00418.79
8.1.160.0050.00318.86
8.1.150.0030.00618.97
8.1.140.0000.00817.71
8.1.130.0000.00718.97
8.1.120.0000.00717.63
8.1.110.0060.00317.61
8.1.100.0080.00017.60
8.1.90.0040.00417.50
8.1.80.0030.00317.63
8.1.70.0030.00317.50
8.1.60.0050.00317.71
8.1.50.0030.00517.63
8.1.40.0000.00717.70
8.1.30.0040.00417.70
8.1.20.0050.00517.79
8.1.10.0020.00517.64
8.1.00.0000.00717.48
8.0.300.0060.00319.68
8.0.290.0000.00716.88
8.0.280.0070.00018.45
8.0.270.0000.00717.19
8.0.260.0000.00817.02
8.0.250.0030.00317.09
8.0.240.0030.00317.09
8.0.230.0040.00416.95
8.0.220.0040.00417.04
8.0.210.0000.00716.93
8.0.200.0030.00517.05
8.0.190.0040.00417.06
8.0.180.0040.00417.04
8.0.170.0040.00417.07
8.0.160.0040.00417.09
8.0.150.0000.00716.98
8.0.140.0000.01116.88
8.0.130.0050.00013.41
8.0.120.0000.00817.02
8.0.110.0000.00716.96
8.0.100.0070.00016.98
8.0.90.0040.00417.05
8.0.80.0060.00916.99
8.0.70.0050.00317.08
8.0.60.0060.00316.83
8.0.50.0040.00416.98
8.0.30.0120.00617.31
8.0.20.0120.00817.40
8.0.10.0000.00917.20
8.0.00.0060.01216.84
7.4.330.0050.00016.86
7.4.320.0030.00616.73
7.4.300.0060.00016.61
7.4.290.0000.00716.81
7.4.280.0040.00416.71
7.4.270.0030.00316.81
7.4.260.0030.00316.71
7.4.250.0040.00416.77
7.4.240.0030.00316.70
7.4.230.0030.00316.90
7.4.220.0180.00616.68
7.4.210.0100.00716.88
7.4.200.0060.00316.79
7.4.160.0120.00716.55
7.4.150.0100.01617.40
7.4.140.0090.01117.86
7.4.130.0210.00416.66
7.4.120.0080.01016.63
7.4.110.0200.00616.79
7.4.100.0120.00916.61
7.4.90.0140.00316.80
7.4.80.0060.01119.39
7.4.70.0060.01616.68
7.4.60.0100.00616.70
7.4.50.0130.00316.42
7.4.40.0110.00616.73
7.4.30.0090.00816.62
7.4.00.0070.00915.17
7.3.330.0030.00313.30
7.3.320.0030.00313.46
7.3.310.0030.00316.58
7.3.300.0030.00316.45
7.3.290.0060.00916.46
7.3.280.0080.01016.45
7.3.270.0070.01017.40
7.3.260.0090.01516.62
7.3.250.0090.00916.57
7.3.240.0070.01016.69
7.3.230.0090.01316.76
7.3.210.0120.00616.61
7.3.200.0030.01916.67
7.3.190.0110.00816.55
7.3.180.0030.01416.55
7.3.170.0070.00916.47
7.3.160.0070.01016.63
7.3.120.0120.00614.96
7.3.110.0090.00615.05
7.3.100.0000.01414.81
7.3.90.0100.00614.98
7.3.80.0030.01315.20
7.3.70.0060.00614.92
7.3.60.0060.00915.14
7.3.50.0060.00615.13
7.3.40.0100.00314.92
7.3.30.0060.00615.07
7.3.20.0080.00616.88
7.3.10.0120.00316.64
7.3.00.0090.00316.91
7.2.330.0130.00316.82
7.2.320.0070.01016.95
7.2.310.0090.00916.91
7.2.300.0130.00316.77
7.2.290.0170.00616.96
7.2.250.0100.00715.42
7.2.240.0110.00415.29
7.2.230.0110.00715.37
7.2.220.0110.00715.28
7.2.210.0100.00715.33
7.2.200.0030.01415.13
7.2.190.0090.00315.16
7.2.180.0060.00915.07
7.2.170.0030.00715.28
7.2.60.0030.01317.21
7.1.330.0060.00916.25
7.1.320.0030.01415.68
7.1.310.0090.00616.02
7.1.300.0070.00715.71
7.1.290.0060.00915.84
7.1.280.0040.00415.85
7.1.270.0030.01016.11
7.1.260.0030.00616.04
7.1.200.0070.00316.20
7.1.110.0030.00818.71
7.1.100.0030.00918.45
7.1.90.0040.00918.34
7.1.80.0000.01218.41
7.1.70.0030.01017.57
7.1.60.0140.01435.37
7.1.50.0120.01535.19
7.1.40.0140.01434.66
7.1.30.0230.00634.72
7.1.20.0100.01634.65
7.1.10.0090.00616.82
7.1.00.0070.01116.83
7.0.250.0070.00418.11
7.0.240.0110.00018.19
7.0.230.0060.00617.86
7.0.220.0000.01218.03
7.0.210.0070.00716.99
7.0.200.0100.00317.08
7.0.190.0110.00317.15
7.0.180.0100.00316.30
7.0.170.0030.01216.34
7.0.160.0060.00616.43
7.0.150.0080.00816.34
7.0.140.0040.01316.52
7.0.130.0070.01116.78
7.0.120.0060.01216.78
7.0.110.0070.00716.55
7.0.100.0030.01016.48
7.0.90.0070.00716.48
7.0.80.0000.01416.60
7.0.70.0090.00416.43
7.0.60.0040.01116.38
7.0.50.0000.01416.32
7.0.40.0050.00916.59
7.0.30.0030.01016.72
7.0.20.0060.00616.60
7.0.10.0060.00616.50
7.0.00.0090.00616.64

preferences:
34.28 ms | 400 KiB | 5 Q