3v4l.org

run code in 300+ PHP versions simultaneously
<?php $userSpecifiedPath = '/news'; // Change me! // Don't edit below =============================================== // ================================================================ // Simple config example // ================================================================ $routerConfig = <<<CONFIG [/] Controller = "HomepageController" [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]; } 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.70.0070.01418.44
8.3.60.0040.01418.45
8.3.50.0140.00722.18
8.3.40.0070.01418.92
8.3.30.0080.00819.22
8.3.20.0040.00420.29
8.3.10.0040.00422.04
8.3.00.0140.00022.51
8.2.190.0110.00416.73
8.2.180.0090.00616.75
8.2.170.0070.00722.96
8.2.160.0100.00620.93
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0050.00319.36
8.2.110.0090.00320.39
8.2.100.0120.00019.51
8.2.90.0040.00419.17
8.2.80.0040.00418.16
8.2.70.0030.00617.50
8.2.60.0030.00917.68
8.2.50.0050.00318.07
8.2.40.0040.00418.34
8.2.30.0040.00418.18
8.2.20.0050.00217.72
8.2.10.0000.00717.71
8.2.00.0060.00317.66
8.1.280.0100.01025.92
8.1.270.0050.00522.11
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00323.83
8.1.230.0110.00019.06
8.1.220.0050.00317.79
8.1.210.0030.00618.77
8.1.200.0090.00017.35
8.1.190.0030.00617.53
8.1.180.0030.00618.78
8.1.170.0000.00818.46
8.1.160.0040.00422.01
8.1.150.0040.00418.52
8.1.140.0000.00817.38
8.1.130.0030.00317.72
8.1.120.0030.00317.48
8.1.110.0040.00417.46
8.1.100.0040.00417.44
8.1.90.0040.00417.38
8.1.80.0030.00417.46
8.1.70.0020.00517.30
8.1.60.0030.00517.57
8.1.50.0000.00717.42
8.1.40.0050.00317.40
8.1.30.0080.00017.66
8.1.20.0030.00617.66
8.1.10.0000.00717.63
8.1.00.0000.00817.44
8.0.300.0000.00818.77
8.0.290.0000.00717.18
8.0.280.0030.00318.47
8.0.270.0000.00717.15
8.0.260.0040.00416.88
8.0.250.0030.00317.08
8.0.240.0030.00317.03
8.0.230.0030.00717.05
8.0.220.0000.00717.01
8.0.210.0030.00616.93
8.0.200.0040.00417.03
8.0.190.0040.00416.93
8.0.180.0040.00417.00
8.0.170.0000.00716.99
8.0.160.0040.00417.02
8.0.150.0050.00317.00
8.0.140.0030.00516.92
8.0.130.0000.00613.32
8.0.120.0000.00716.98
8.0.110.0040.00416.93
8.0.100.0040.00416.77
8.0.90.0000.00716.93
8.0.80.0000.01416.88
8.0.70.0000.00816.79
8.0.60.0040.00416.76
8.0.50.0080.00016.94
8.0.30.0130.00617.06
8.0.20.0080.01117.40
8.0.10.0050.00316.98
8.0.00.0130.01116.78
7.4.330.0050.00015.00
7.4.320.0000.00616.64
7.4.300.0030.00316.62
7.4.290.0020.00816.43
7.4.280.0000.00716.63
7.4.270.0000.00716.64
7.4.260.0040.00416.50
7.4.250.0040.00416.55
7.4.240.0050.00316.48
7.4.230.0030.00316.64
7.4.220.0190.00616.57
7.4.210.0060.01016.65
7.4.200.0000.00716.32
7.4.190.0070.00016.48
7.4.160.0130.00316.61
7.4.150.0100.01017.40
7.4.140.0140.00617.86
7.4.130.0110.00816.55
7.4.120.0120.00716.55
7.4.110.0100.01016.47
7.4.100.0070.01116.57
7.4.90.0130.00716.56
7.4.80.0110.00619.39
7.4.70.0100.00716.70
7.4.60.0060.01016.34
7.4.50.0000.00916.18
7.4.40.0100.00722.77
7.4.30.0090.00916.62
7.4.10.0030.01715.03
7.4.00.0070.01214.81
7.3.330.0050.00013.47
7.3.320.0000.00513.42
7.3.310.0050.00216.49
7.3.300.0070.00016.32
7.3.290.0110.00316.46
7.3.280.0110.01016.47
7.3.270.0150.00917.40
7.3.260.0150.00316.55
7.3.250.0080.01016.56
7.3.240.0090.00916.50
7.3.230.0100.00616.58
7.3.210.0110.00516.47
7.3.200.0070.01019.39
7.3.190.0060.01616.60
7.3.180.0060.00916.44
7.3.170.0110.00616.45
7.3.160.0030.01316.60
7.3.130.0040.01414.68
7.3.120.0050.01214.67
7.3.110.0100.01014.95
7.3.100.0060.00615.08
7.3.90.0080.00814.93
7.3.80.0080.00514.89
7.3.70.0040.00414.70
7.3.60.0060.00914.96
7.3.50.0030.01314.91
7.3.40.0030.01414.69
7.3.30.0030.01214.71
7.3.20.0120.00316.75
7.3.10.0100.00716.65
7.3.00.0060.00916.54
7.2.330.0030.01816.81
7.2.320.0060.01116.76
7.2.310.0070.01016.81
7.2.300.0110.00616.78
7.2.290.0030.01316.57
7.2.260.0060.01015.24
7.2.250.0130.00614.85
7.2.240.0140.00014.96
7.2.230.0070.01015.36
7.2.220.0040.01215.19
7.2.210.0070.00715.20
7.2.200.0030.00915.07
7.2.190.0080.00814.93
7.2.180.0100.01015.01
7.2.170.0070.00315.11
7.2.160.0000.00915.00
7.2.150.0090.00916.98
7.2.140.0090.00616.84
7.2.130.0100.00816.57
7.2.120.0110.00716.67
7.2.110.0130.00616.63
7.2.100.0080.00516.95
7.2.90.0110.00416.61
7.2.80.0090.00916.78
7.2.70.0100.00816.83
7.2.60.0070.01016.55
7.2.50.0090.00716.82
7.2.40.0110.00716.84
7.2.30.0110.00816.72
7.2.20.0080.00716.71
7.2.10.0060.01116.79
7.2.00.0070.00816.69
7.1.330.0100.00315.86
7.1.320.0000.01515.77
7.1.310.0000.00915.80
7.1.300.0130.00315.96
7.1.290.0090.00915.81
7.1.280.0080.00615.85
7.1.270.0080.00515.63
7.1.260.0130.00015.68
7.1.250.0080.01115.69
7.1.240.0070.01116.04
7.1.230.0060.00915.75
7.1.220.0060.01215.68
7.1.210.0080.00815.56
7.1.200.0040.00815.92
7.1.190.0040.00715.95
7.1.180.0130.00015.89
7.1.170.0060.00615.91
7.1.160.0070.01115.80
7.1.150.0120.00015.97
7.1.140.0040.00715.75
7.1.130.0000.01115.82
7.1.120.0080.00816.02
7.1.110.0080.01215.66
7.1.100.0030.01215.96
7.1.90.0050.00515.79
7.1.80.0070.00715.71
7.1.70.0020.01016.61
7.1.60.0090.00817.77
7.1.50.0070.01216.49
7.1.40.0090.00315.83
7.1.30.0110.00415.85
7.1.20.0000.01715.60
7.1.10.0060.00315.71
7.1.00.0070.04019.08
7.0.330.0070.00715.36
7.0.320.0000.01315.51
7.0.310.0040.01115.39
7.0.300.0030.01415.46
7.0.290.0120.00015.40
7.0.280.0070.00715.41
7.0.270.0100.00315.29
7.0.260.0110.00315.38
7.0.250.0000.01015.40
7.0.240.0000.00815.31
7.0.230.0060.00615.61
7.0.220.0050.00815.16
7.0.210.0060.00915.52
7.0.200.0070.00416.01
7.0.190.0090.00315.44
7.0.180.0000.01115.50
7.0.170.0000.00915.26
7.0.160.0030.00715.50
7.0.150.0060.00315.13
7.0.140.0030.04118.69
7.0.130.0030.00715.14
7.0.120.0050.00815.55
7.0.110.0030.01015.20
7.0.100.0090.00615.54
7.0.90.0040.01115.47
7.0.80.0060.00615.39
7.0.70.0030.01015.45
7.0.60.0060.04217.64
7.0.50.0090.02016.71
7.0.40.0090.02916.71
7.0.30.0210.04016.84
7.0.20.0290.03716.88
7.0.10.0030.04816.89
7.0.00.0070.03216.85
5.6.400.0100.00314.48
5.6.390.0090.00614.52
5.6.380.0030.00614.52
5.6.370.0060.00614.64
5.6.360.0000.01514.32
5.6.350.0070.01014.56
5.6.340.0030.00914.11
5.6.330.0000.01114.16
5.6.320.0040.01513.92
5.6.310.0000.01414.40
5.6.300.0090.00314.41
5.6.290.0060.00914.62
5.6.280.0050.04017.89
5.6.270.0100.00314.79
5.6.260.0110.00314.40
5.6.250.0090.00314.23
5.6.240.0060.00614.22
5.6.230.0030.01014.41
5.6.220.0070.00714.46
5.6.210.0050.03517.52
5.6.200.0080.04716.31
5.6.190.0050.02717.48
5.6.180.0220.02317.57
5.6.170.0140.03017.49
5.6.160.0050.02517.32
5.6.150.0050.04216.31
5.6.140.0070.04716.36
5.6.130.0040.03616.23
5.6.120.0060.02517.66
5.6.110.0100.03217.76
5.6.100.0070.03517.92
5.6.90.0040.05617.81
5.6.80.0050.04317.38
5.6.70.0040.01114.10
5.6.60.0060.00914.39
5.6.50.0040.01214.20
5.6.40.0070.00714.38
5.6.30.0000.01514.12
5.6.20.0070.01014.15
5.6.10.0040.00714.22
5.6.00.0040.01114.43
5.5.380.0060.00614.14
5.5.370.0060.01014.45
5.5.360.0100.00314.05
5.5.350.1920.02217.45
5.5.340.0050.02316.28
5.5.330.0030.05017.29
5.5.320.0200.02717.43
5.5.310.0210.03817.30
5.5.300.0090.04016.18
5.5.290.0100.04116.11
5.5.280.0070.04617.62
5.5.270.0120.04117.46
5.5.260.0060.04817.57
5.5.250.0070.04017.47
5.5.240.0090.02917.27
5.5.230.0080.00014.06
5.5.220.0080.00014.03
5.5.210.0080.00814.07
5.5.200.0000.01014.53
5.5.190.0070.01014.40
5.5.180.0060.00914.07
5.5.170.0080.00314.34
5.5.160.0050.00914.50
5.5.150.0090.00914.53
5.5.140.0070.01014.45
5.5.130.0060.00914.29
5.5.120.0090.00614.13
5.5.110.0060.00714.14
5.5.100.0030.00914.53
5.5.90.0070.00414.08
5.5.80.0030.01314.24
5.5.70.0000.01213.98
5.5.60.0060.01214.23
5.5.50.0110.00414.17
5.5.40.0070.00714.57
5.5.30.0080.00814.59
5.5.20.0030.00914.27
5.5.10.0030.01014.22
5.5.00.0030.01014.21
5.4.450.1700.02815.94
5.4.440.1840.02115.97
5.4.430.1900.01615.84
5.4.420.1810.02616.01
5.4.410.1930.02315.88
5.4.400.1820.02115.87
5.4.390.1790.02115.67
5.4.380.1860.01615.79
5.4.370.1750.02415.79
5.4.360.1850.02315.73
5.4.350.1820.02215.90
5.4.340.1980.02615.79
5.4.330.0000.01012.49
5.4.320.1980.02415.82
5.4.310.2140.01315.79
5.4.300.1980.01715.84
5.4.290.1900.01915.85
5.4.280.2070.02815.79
5.4.270.1940.02015.86
5.4.260.2130.02315.85
5.4.250.1940.02115.86
5.4.240.1980.02315.82
5.4.230.1950.02315.73
5.4.220.1930.01815.71
5.4.210.1920.02215.77
5.4.200.2130.02515.81
5.4.190.1990.01715.74
5.4.180.1750.02015.78
5.4.170.1830.02715.67
5.4.160.1990.02115.72
5.4.150.1940.02215.81
5.4.140.1970.02114.42
5.4.130.1920.01614.46
5.4.120.1820.02114.45
5.4.110.1950.02014.52
5.4.100.1820.02214.34
5.4.90.1760.02414.47
5.4.80.2080.02314.52
5.4.70.1730.02314.37
5.4.60.1920.02514.37
5.4.50.1900.02114.48
5.4.40.1950.02214.51
5.4.30.1970.02214.46
5.4.20.1800.01814.46
5.4.10.1850.02314.51
5.4.00.1630.02114.17
5.3.290.1950.02113.54
5.3.280.1860.01813.59
5.3.270.1850.01813.66
5.3.260.1940.02313.54
5.3.250.1880.02113.55
5.3.240.1930.02313.56
5.3.230.1900.02513.50
5.3.220.1820.01913.52
5.3.210.2120.02013.57
5.3.200.1900.02413.49
5.3.190.1970.02113.53
5.3.180.1980.01913.57
5.3.170.2070.02613.52
5.3.160.1800.02413.61
5.3.150.1880.02213.56
5.3.140.1840.02213.57
5.3.130.1960.01813.48
5.3.120.1950.02513.47
5.3.110.2490.02313.56
5.3.100.1660.02213.32
5.3.90.1810.02113.30
5.3.80.1830.02513.22
5.3.70.1880.02113.22
5.3.60.1870.02313.26
5.3.50.1550.01813.27
5.3.40.1690.01913.23
5.3.30.1800.02313.28
5.3.20.1670.01313.11
5.3.10.1800.02213.03
5.3.00.1980.02213.02
5.2.170.2670.03311.25
5.2.160.2800.03011.22
5.2.150.4100.02711.24
5.2.140.3030.02711.25
5.2.130.3030.03011.18
5.2.120.3030.02311.06
5.2.110.3230.02711.04
5.2.100.2970.03011.04
5.2.90.3570.03311.05
5.2.80.2970.03011.17
5.2.70.3230.03311.12
5.2.60.3270.02311.14
5.2.50.3100.03011.05
5.2.40.2500.02711.09
5.2.30.2670.02310.90
5.2.20.2630.02710.96
5.2.10.2900.03311.03
5.2.00.3170.03010.65
5.1.60.2830.03010.01
5.1.50.2830.0279.95
5.1.40.2870.02310.12
5.1.30.3130.02010.40
5.1.20.2800.02710.44
5.1.10.3170.0279.97
5.1.00.2830.0239.97
5.0.50.2000.0209.75
5.0.40.1730.0209.75
5.0.30.1400.0339.75
5.0.20.1300.0279.75
5.0.10.1500.0209.75
5.0.00.1300.0379.75
4.4.90.1500.0179.75
4.4.80.1470.0179.75
4.4.70.1200.0179.75
4.4.60.1200.0209.75
4.4.50.1530.0179.75
4.4.40.1430.0279.75
4.4.30.1430.0179.75
4.4.20.1670.0209.75
4.4.10.1730.0139.75
4.4.00.1670.0239.75
4.3.110.1400.0179.75
4.3.100.1770.0179.75
4.3.90.1430.0179.75
4.3.80.1430.0309.75
4.3.70.1500.0179.75
4.3.60.1470.0179.75
4.3.50.1430.0209.75
4.3.40.1370.0279.75
4.3.30.0800.0279.75
4.3.20.0830.0179.75
4.3.10.0930.0209.75
4.3.00.0930.0239.75

preferences:
52.56 ms | 401 KiB | 5 Q