3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Router { private $routeList; public function addRoute($url, $callback){ $this->routeList[$url] = $callback; } public function route($url){ $this->routeList[$url]->call($this, $url); } } class HomeController { public function __construct($router){ $router->addRoute('/', function(){ return $this->doHomePage(); }); } private function doHomePage(){ $quote = $this->getRandomQuote(); return new Response('home.html', ['quote' => $quote]); } private function getRandomQuote(){ $quotes = ['You can do anything, but not everything.—David Allen', ' The richest man is not he who has the most, but he who needs the least. —Unknown Author','You miss 100 percent of the shots you never take.—Wayne Gretzky']; return $quotes[array_rand($quotes)]; } } class Response { public function __construct($template, $data){ } } $router = new Router(); $controller = new HomeController($router); $router->route('/');

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)
7.4.00.0070.01014.79
7.3.120.0070.01014.82
7.3.110.0100.00714.85
7.3.100.0070.00614.89
7.3.90.0030.01214.74
7.3.80.0060.00714.85
7.3.70.0060.00814.94
7.3.60.0030.01114.67
7.3.50.0060.00814.74
7.3.40.0050.01114.91
7.3.30.0030.01314.90
7.3.20.0050.00616.63
7.3.10.0050.00716.64
7.3.00.0050.00916.75
7.2.250.0070.00915.01
7.2.240.0080.01015.21
7.2.230.0060.00814.84
7.2.220.0070.00814.88
7.2.210.0070.00715.00
7.2.200.0040.00914.96
7.2.190.0060.00915.02
7.2.180.0070.00914.90
7.2.170.0060.00915.13
7.1.330.0030.01015.84
7.1.320.0090.00615.75
7.1.310.0040.01015.71
7.1.300.0030.01015.57
7.1.290.0080.00715.81
7.1.280.0040.01015.70
7.1.270.0080.00615.65
7.1.260.0070.00715.70
7.1.120.0150.01116.65
7.1.110.0140.01116.38
7.1.100.0170.01016.30
7.1.90.0200.01016.26
7.1.80.1160.01016.64
7.1.70.0230.00715.27
7.1.60.0400.00333.01
7.1.50.0410.00632.80
7.1.40.0320.01632.69
7.1.30.0510.01432.74
7.1.20.0470.01932.78
7.1.10.0260.01614.70
7.1.00.0220.00914.77
7.0.250.0170.01016.06
7.0.240.0170.01215.98
7.0.230.0210.00715.92
7.0.220.0220.00615.86
7.0.210.0210.00914.52
7.0.200.0160.01315.05
7.0.190.0190.01014.62
7.0.180.0220.00614.50
7.0.170.0370.00914.72
7.0.160.0370.00814.52
7.0.150.0290.00414.52
7.0.140.0250.00614.62
7.0.130.0270.00314.58
7.0.120.0230.00614.75
7.0.110.0190.01014.43
7.0.100.0150.01514.56
7.0.90.0260.00314.49
7.0.80.0320.01314.35
7.0.70.0160.01314.66
7.0.60.0250.00614.25
7.0.50.0220.00714.70
7.0.40.0270.00314.86
7.0.30.0200.01014.43
7.0.20.1190.01314.80
7.0.10.0260.00614.71
7.0.00.0240.00714.59

preferences:
37.86 ms | 401 KiB | 5 Q