3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Backup_Config { public $a = ''; function __construct() { $this->a = time(); } } class Backup extends Backup_Config { public $b = 'test'; function __construct() { parent::__construct(); echo __CLASS__ . ':' . $this->a . '<BR>'; } public function foo () { $helper = new Backup_Helper(); echo __FUNCTION__ . ':' . $this->a . '<BR>'; $helper->bar(); } } class Backup_Helper extends Backup { public function bar() { echo __FUNCTION__ . ':' . $this->a . ' and ' . $this->b . '<BR>'; } } $init = new Backup(); $init->foo();
Output for 5.6.0 - 5.6.30, hhvm-3.12.14 - 3.17.3, 7.0.0 - 7.2.11
Backup:1486173600<BR>Backup:1486173600<BR>foo:1486173600<BR>bar:1486173600 and test<BR>