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();

preferences:
25.29 ms | 404 KiB | 5 Q