3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DIContainer { var private $properties = array(); public function __set($propertyName, $value) { $this->properties[$propertyName] = $value; } public function __get($propertyName) { return is_callable($this->properties[$propertyName]) ? $this->properties[$propertyName]($this) : $this->properties[$propertyName]; } } class DatabaseConnection { var public $hostname; var public $username; var public $password; public function __construct($hostname, $username, $password) { $this->hostname = $hostname; $this->username = $username; $this->password = $password; } } $di = new DIContainer(); $di->databaseHostname = 'dbmaster'; $di->databaseUsername = 'user'; $di->databasePassword = '123456'; $di->databaseConnectionClass = 'DatabaseConnection'; $di->databaseConnection = function ($di) { $className = $di->databaseConnectionClass; return new $className($di->databaseHostname, $di->databaseUsername, $di->databasePassword); }; $db = $di->databaseConnection; print_r($db);

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)
5.4.240.0080.04412.38
5.4.230.0090.04112.38
5.4.220.0080.04012.38
5.4.210.0080.03912.38
5.4.200.0050.04412.37
5.4.190.0090.04212.37
5.4.180.0080.04212.37
5.4.170.0070.04412.38
5.4.160.0100.04012.38
5.4.150.0090.04912.37
5.4.140.0070.04112.06
5.4.130.0080.03812.04
5.4.120.0090.03812.01
5.4.110.0080.03812.00
5.4.100.0060.03812.00
5.4.90.0090.04312.00
5.4.80.0110.03712.00
5.4.70.0090.03812.00
5.4.60.0070.04212.00
5.4.50.0080.04512.00
5.4.40.0070.04511.99
5.4.30.0090.04111.99
5.4.20.0060.04211.98
5.4.10.0070.03911.99
5.4.00.0070.03811.48
5.3.280.0080.04212.71
5.3.270.0060.04312.72
5.3.260.0080.04212.72
5.3.250.0080.04012.72
5.3.240.0090.04212.72
5.3.230.0100.04012.71
5.3.220.0100.04212.68
5.3.210.0070.04512.68
5.3.200.0100.04512.68
5.3.190.0100.04812.68
5.3.180.0090.04512.68
5.3.170.0080.04312.67
5.3.160.0100.04412.67
5.3.150.0090.04312.67
5.3.140.0100.04612.66
5.3.130.0070.05212.66
5.3.120.0090.04212.66
5.3.110.0080.04512.66
5.3.100.0060.04312.12
5.3.90.0070.03812.09
5.3.80.0070.03812.08
5.3.70.0100.04112.08
5.3.60.0060.04112.07
5.3.50.0070.03912.01
5.3.40.0090.04012.01
5.3.30.0090.03911.96
5.3.20.0080.03911.74
5.3.10.0070.03611.71
5.3.00.0050.04011.69

preferences:
160.49 ms | 1394 KiB | 7 Q