3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Change me! $userSpecifiedPath = '/'; // works, HomepageController // $userSpecifiedPath = '/asdf'; // route doesn't exist, 404Controller //$userSpecifiedPath = '/deep/nested/controller'; // // Don't edit below =============================================== // ================================================================ // Simple config example // ================================================================ $routerConfig = <<<CONFIG [/] Controller = "HomepageController" [/deep*] Controller = "DeepController" [404] Controller = "404Controller" CONFIG; // ================================================================ // Simple router example // ================================================================ class Router { private $routes; public function __construct($routes) { $this->routes = $routes; } public function getRouteFromPath($path) { if(array_key_exists($path, $this->routes) === true) { return $this->routes[$path]; } $hierarchical = $this->getHierarchicalRouteFromPath($path); if(!empty($hierarchical)) { return $hierarchical; } elseif(array_key_exists('404', $this->routes) === true) { return $this->routes['404']; } throw new Exception('No controllers found.'); } public function getAllHierarchicalRoutes() { $routes = array(); foreach($this->routes as $key => $route) { if(strpos($key, '*') === strlen($key) - 1) { $routes[$key] = $route; } } return $routes; } public function getHierarchicalRouteFromPath($path) { foreach($this->routes as $key => $route) { if(strpos($key, '*') === strlen($key) - 1) { if(strpos($path, rtrim($key, '*')) === 0) { return $route; } } } } } // ================================================================ // Sample output // ================================================================ $routes = parse_ini_string($routerConfig, true); $Router = new Router($routes); $selectedRoute = $Router->getRouteFromPath($userSpecifiedPath); echo 'Using controller: ' . $selectedRoute['Controller'];

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.00618.43
8.3.50.0120.00822.05
8.3.40.0040.01119.06
8.3.30.0070.00719.14
8.3.20.0000.00720.14
8.3.10.0030.00622.05
8.3.00.0060.00922.58
8.2.180.0110.00418.16
8.2.170.0110.00422.96
8.2.160.0150.00420.93
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00319.23
8.2.110.0030.00720.47
8.2.100.0090.00319.64
8.2.90.0040.00419.25
8.2.80.0030.00617.97
8.2.70.0050.00517.63
8.2.60.0090.00018.05
8.2.50.0040.00418.07
8.2.40.0090.00018.34
8.2.30.0050.00218.02
8.2.20.0050.00217.79
8.2.10.0000.00717.64
8.2.00.0000.00817.74
8.1.280.0030.01725.92
8.1.270.0030.00522.19
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00623.91
8.1.230.0040.00719.01
8.1.220.0030.00517.79
8.1.210.0040.00418.77
8.1.200.0100.00017.22
8.1.190.0000.00817.53
8.1.180.0050.00318.82
8.1.170.0040.00418.42
8.1.160.0040.00422.03
8.1.150.0040.00418.47
8.1.140.0040.00417.46
8.1.130.0000.00717.73
8.1.120.0030.00317.47
8.1.110.0050.00317.41
8.1.100.0000.00817.41
8.1.90.0030.00317.32
8.1.80.0000.00717.43
8.1.70.0020.00517.41
8.1.60.0090.00017.60
8.1.50.0040.00417.39
8.1.40.0030.00617.49
8.1.30.0050.00317.66
8.1.20.0050.00317.61
8.1.10.0000.00817.62
8.1.00.0000.00817.50
8.0.300.0070.00018.77
8.0.290.0040.00417.05
8.0.280.0000.00718.51
8.0.270.0070.00017.18
8.0.260.0040.00416.96
8.0.250.0000.00617.03
8.0.240.0030.00416.95
8.0.230.0100.00016.98
8.0.220.0000.00716.96
8.0.210.0000.00716.99
8.0.200.0060.00016.95
8.0.190.0040.00416.96
8.0.180.0040.00417.01
8.0.170.0000.00716.98
8.0.160.0040.00417.01
8.0.150.0030.00416.91
8.0.140.0070.00016.89
8.0.130.0000.00613.41
8.0.120.0000.00816.88
8.0.110.0050.00316.89
8.0.100.0000.00716.86
8.0.90.0000.00716.97
8.0.80.0070.01116.94
8.0.70.0000.00716.78
8.0.60.0050.00216.80
8.0.50.0000.00816.81
8.0.30.0100.00917.25
8.0.20.0110.00817.40
8.0.10.0040.00416.91
8.0.00.0130.01217.05
7.4.330.0000.00515.00
7.4.320.0000.00716.45
7.4.300.0000.00716.44
7.4.290.0060.00316.62
7.4.280.0040.00416.51
7.4.270.0070.00016.63
7.4.260.0000.00716.54
7.4.250.0000.00716.61
7.4.240.0030.00516.49
7.4.230.0030.00316.52
7.4.220.0060.01216.55
7.4.210.0060.01016.52
7.4.200.0070.00016.53
7.4.190.0000.00816.46
7.4.160.0110.00416.54
7.4.150.0160.00317.40
7.4.140.0100.00817.86
7.4.130.0090.00816.66
7.4.120.0130.00816.54
7.4.110.0130.00416.55
7.4.100.0100.00716.52
7.4.90.0120.01216.63
7.4.80.0090.00819.39
7.4.70.0060.01016.48
7.4.60.0060.01216.46
7.4.50.0030.00616.51
7.4.40.0060.00922.77
7.4.30.0100.00716.52
7.4.10.0070.00714.84
7.4.00.0080.00814.88
7.3.330.0030.00313.29
7.3.320.0000.00613.20
7.3.310.0030.00316.47
7.3.300.0030.00316.32
7.3.290.0150.00616.46
7.3.280.0070.01016.46
7.3.270.0110.01117.40
7.3.260.0080.00916.42
7.3.250.0080.01016.36
7.3.240.0120.00916.57
7.3.230.0100.00716.57
7.3.210.0090.00916.48
7.3.200.0090.00819.39
7.3.190.0060.01216.41
7.3.180.0130.00916.51
7.3.170.0090.00916.38
7.3.160.0030.01316.46
7.3.130.0100.00714.84
7.3.120.0060.00914.80
7.3.110.0090.00614.59
7.3.100.0130.00015.08
7.3.90.0070.00415.08
7.3.80.0030.01014.88
7.3.70.0040.01114.81
7.3.60.0100.00314.80
7.3.50.0060.00314.78
7.3.40.0080.00414.76
7.3.30.0110.00414.55
7.3.20.0030.01016.82
7.3.10.0080.00616.42
7.3.00.0100.00116.33
7.2.330.0100.00716.57
7.2.320.0100.00616.84
7.2.310.0100.00716.51
7.2.300.0000.01616.81
7.2.290.0100.00616.50
7.2.260.0040.01515.04
7.2.250.0060.00615.28
7.2.240.0000.01315.05
7.2.230.0000.01414.89
7.2.220.0000.01814.99
7.2.210.0070.00715.09
7.2.200.0060.00315.05
7.2.190.0030.01014.92
7.2.180.0100.00315.04
7.2.170.0120.00314.89
7.2.160.0040.00814.97
7.2.150.0090.00616.83
7.2.140.0040.01116.94
7.2.130.0070.00816.93
7.2.120.0070.00616.81
7.2.110.0100.00816.89
7.2.100.0100.00816.76
7.2.90.0100.00816.85
7.2.80.0110.00416.68
7.2.70.0110.00616.91
7.2.60.0070.01016.79
7.2.50.0100.01016.83
7.2.40.0090.00816.72
7.2.30.0100.00816.71
7.2.20.0090.00816.86
7.2.10.0080.00816.96
7.2.00.0110.00617.55
7.1.330.0120.00315.81
7.1.320.0120.00015.90
7.1.310.0080.00415.77
7.1.300.0040.01115.79
7.1.290.0030.00915.78
7.1.280.0110.00415.86
7.1.270.0060.00315.84
7.1.260.0040.00715.91
7.1.250.0040.01115.72
7.1.240.0030.00915.75
7.1.230.0040.00715.94
7.1.220.0030.01015.96
7.1.210.0070.00315.80
7.1.200.0050.00615.82
7.1.190.0000.01515.79
7.1.180.0120.00015.94
7.1.170.0030.00615.70
7.1.160.0060.00315.97
7.1.150.0040.00415.54
7.1.140.0060.00615.76
7.1.130.0110.00315.62
7.1.120.0060.00315.92
7.1.110.0060.00615.70
7.1.100.0020.01217.03
7.1.90.0040.00715.96
7.1.80.0040.01115.63
7.1.70.0030.00516.46
7.1.60.0050.01417.89
7.1.50.0120.00816.41
7.1.40.0030.00915.84
7.1.30.0080.00315.62
7.1.20.0080.00015.58
7.1.10.0030.00915.61
7.1.00.0120.03719.05
7.0.330.0000.01315.31
7.0.320.0040.00415.40
7.0.310.0060.00615.43
7.0.300.0030.00915.45
7.0.290.0000.00915.46
7.0.280.0030.00715.36
7.0.270.0000.01015.28
7.0.260.0000.01515.19
7.0.250.0110.00415.23
7.0.240.0030.00715.50
7.0.230.0070.00715.17
7.0.220.0000.01515.61
7.0.210.0070.00315.48
7.0.200.0000.01215.91
7.0.190.0100.00715.52
7.0.180.0030.01015.46
7.0.170.0030.00715.57
7.0.160.0030.00615.41
7.0.150.0070.00715.55
7.0.140.0040.04118.73
7.0.130.0100.00015.41
7.0.120.0060.00615.61
7.0.110.0030.01015.11
7.0.100.0060.00615.16
7.0.90.0040.00815.23
7.0.80.0000.01215.14
7.0.70.0030.00915.39
7.0.60.0070.02217.66
7.0.50.0030.04516.75
7.0.40.0080.02316.92
7.0.30.0180.04316.89
7.0.20.0110.02516.81
7.0.10.0160.04516.70
7.0.00.0050.04916.63
5.6.400.0100.00314.42
5.6.390.0100.00314.32
5.6.380.0030.01014.43
5.6.370.0050.00514.30
5.6.360.0060.00614.28
5.6.350.0030.01014.40
5.6.340.0030.00614.37
5.6.330.0030.01014.66
5.6.320.0030.01014.39
5.6.310.0030.01014.59
5.6.300.0000.01314.68
5.6.290.0070.00714.54
5.6.280.0030.04017.76
5.6.270.0100.00614.74
5.6.260.0000.01214.42
5.6.250.0070.00714.51
5.6.240.0090.00314.39
5.6.230.0060.00314.64
5.6.220.0030.00914.24
5.6.210.0080.04017.61
5.6.200.0050.03716.43
5.6.190.0070.04217.56
5.6.180.1980.02717.54
5.6.170.0160.02717.56
5.6.160.0070.04217.37
5.6.150.0080.02416.19
5.6.140.0060.02716.35
5.6.130.0030.03616.29
5.6.120.0050.02917.78
5.6.110.0050.04017.71
5.6.100.0120.04217.71
5.6.90.0020.02717.76
5.6.80.0080.04217.33
5.6.70.0080.02117.44
5.6.60.0100.00314.46
5.6.50.0000.00914.14
5.6.40.0090.00614.42
5.6.30.0060.00614.26
5.6.20.0070.00714.33
5.6.10.0000.01114.39
5.6.00.0000.01414.29
5.5.380.0060.00614.68
5.5.370.0030.00614.38
5.5.360.0060.00614.40
5.5.350.0060.04317.28
5.5.340.0050.04516.14
5.5.330.0120.04017.41
5.5.320.0150.02317.44
5.5.310.0170.02517.47
5.5.300.0030.02316.07
5.5.290.0110.03816.10
5.5.280.0030.02317.72
5.5.270.0050.02517.72
5.5.260.0030.02617.50
5.5.250.0030.04617.38
5.5.240.0070.02217.22
5.5.230.0140.00014.30
5.5.220.0130.00314.36
5.5.210.0090.00314.42
5.5.200.0030.01014.17
5.5.190.0030.01314.36
5.5.180.0070.00714.20
5.5.170.0030.00614.40
5.5.160.0060.00614.32
5.5.150.0000.01314.25
5.5.140.0090.00014.50
5.5.130.0030.00714.18
5.5.120.0090.00314.27
5.5.110.0100.00314.29
5.5.100.0030.01014.15
5.5.90.0000.01714.53
5.5.80.0060.00914.54
5.5.70.0070.00714.38
5.5.60.0050.00514.43
5.5.50.0030.00914.19
5.5.40.0030.01013.93
5.5.30.0060.00614.24
5.5.20.0030.01014.56
5.5.10.0050.00514.46
5.5.00.0040.00414.25
5.4.450.0020.03315.89
5.4.440.0360.03315.81
5.4.430.0110.03615.80
5.4.420.0120.03315.88
5.4.410.0050.03215.75
5.4.400.0640.00415.52
5.4.390.0550.00215.47
5.4.380.0130.03015.54
5.4.370.0160.02915.43
5.4.360.0150.02915.41
5.4.350.0200.02315.51
5.4.340.0120.03415.36
5.4.330.0060.00612.24
5.4.320.0020.02712.37
5.4.310.0040.02612.37
5.4.300.0020.02712.38
5.4.290.0040.02312.37
5.4.280.0060.02512.32
5.4.270.0040.02312.32
5.4.260.0070.02815.61
5.4.250.0020.03515.62
5.4.240.0060.03015.59
5.4.230.0030.03915.59
5.4.220.0020.03415.60
5.4.210.0090.02515.61
5.4.200.0080.02815.53
5.4.190.0090.02415.51
5.4.180.0050.04315.61
5.4.170.0050.03815.66
5.4.160.0120.02815.53
5.4.150.0030.03415.47
5.4.140.0080.02814.37
5.4.130.0050.04314.31
5.4.120.0020.03614.39
5.4.110.0150.03214.37
5.4.100.0150.01814.36
5.4.90.0080.02614.44
5.4.80.0080.03714.31
5.4.70.0030.02714.27
5.4.60.0050.02714.37
5.4.50.0050.03714.37
5.4.40.0050.03014.30
5.4.30.0080.02614.35
5.4.20.0020.03114.35
5.4.10.0150.02514.36
5.4.00.0080.03114.10
5.3.290.0030.02712.52
5.3.280.0080.02513.51
5.3.270.0060.02913.42
5.3.260.0080.03213.52
5.3.250.0050.04013.41
5.3.240.0050.03513.44
5.3.230.0070.02713.43
5.3.220.0020.03213.42
5.3.210.0100.02513.43
5.3.200.0030.03013.40
5.3.190.0080.02813.47
5.3.180.0030.03113.45
5.3.170.0070.03913.44
5.3.160.0070.02813.46
5.3.150.0050.03013.45
5.3.140.0100.03513.41
5.3.130.0050.03013.46
5.3.120.0020.03213.38
5.3.110.0080.02513.31
5.3.100.0130.02213.22
5.3.90.0030.03013.17
5.3.80.0060.03113.18
5.3.70.0080.02813.18
5.3.60.0090.02913.17
5.3.50.0070.02713.14
5.3.40.0060.02613.05
5.3.30.0080.02513.07
5.3.20.0080.02513.06
5.3.10.0030.03012.99
5.3.00.0030.03013.03
5.2.170.0030.05011.39
5.2.160.0070.03711.13
5.2.150.0030.06711.17
5.2.140.0100.04311.11
5.2.130.0030.04711.18
5.2.120.0130.03311.28
5.2.110.0070.05311.30
5.2.100.0030.06011.11
5.2.90.0070.04011.29
5.2.80.0100.04011.18
5.2.70.0130.04711.11
5.2.60.0070.04011.14
5.2.50.0100.05711.02
5.2.40.0030.04011.11
5.2.30.0030.04711.05
5.2.20.0070.04311.07
5.2.10.0070.04010.95
5.2.00.0070.05310.70
5.1.60.0070.03310.11
5.1.50.0030.0409.93
5.1.40.0000.05310.05
5.1.30.0070.03310.44
5.1.20.0000.04310.35
5.1.10.0070.03310.05
5.1.00.0030.04010.07
5.0.50.0130.0238.66
5.0.40.0030.0278.43
5.0.30.0070.0608.49
5.0.20.0130.0178.14
5.0.10.0000.0308.30
5.0.00.0000.0478.16
4.4.90.0070.0177.16
4.4.80.0030.0207.16
4.4.70.0030.0207.16
4.4.60.0000.0277.16
4.4.50.0030.0207.16
4.4.40.0030.0337.16
4.4.30.0030.0307.16
4.4.20.0000.0237.16
4.4.10.0070.0237.16
4.4.00.0000.0337.16
4.3.110.0070.0177.16
4.3.100.0030.0207.16
4.3.90.0000.0237.16
4.3.80.0130.0237.16
4.3.70.0030.0307.16
4.3.60.0070.0277.16
4.3.50.0030.0207.16
4.3.40.0030.0307.16
4.3.30.0070.0177.16
4.3.20.0100.0177.16
4.3.10.0000.0277.16
4.3.00.0130.0207.32

preferences:
46.75 ms | 401 KiB | 5 Q