3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class DIContainer { 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->properties[$propertyName]; } } class SessionClass { public $cookieName; public function __construct($cookieName) { $this->cookieName = $cookieName; } } class Application { public static function run() { $di = new DIContainer(); $di->sessionCookieName = 'id'; $di->sessionStorageClass = 'Session'; $di->sessionStorage = function ($di) { return new {$di->sessionStorageClass}($di->sessionCookieName); }; $sessionHandler = $di->sessionStorage; echo get_class($sessionHandler), "\n", $sessionHandler->cookieName; } } Application::run();
Output for 5.3.0 - 5.4.24
Parse error: syntax error, unexpected '{' in /in/po1kI on line 26
Process exited with code 255.