3v4l.org

run code in 300+ PHP versions simultaneously
<?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 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.11
Backup:1486173600<BR>Backup:1486173600<BR>foo:1486173600<BR>bar:1486173600 and test<BR>

preferences:
41.74 ms | 406 KiB | 5 Q