2
ZE2 A derived class can use the inherited constructor/destructor
4
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
8
// This test checks for:
9
// - inherited constructors/destructors are not called automatically
10
// - base classes know about derived properties in constructor/destructor
11
// - base class constructors/destructors know the instanciated class name
16
function __construct() {
17
echo __CLASS__ . "::" . __FUNCTION__ . "\n";
22
function __destruct() {
23
echo __CLASS__ . "::" . __FUNCTION__ . "\n";
28
class derived extends base {
31
function __construct() {
33
$this->other = 'other';
35
parent::__construct();
36
echo __CLASS__ . "::" . __FUNCTION__ . "\n";
37
$this->name = 'derived';
41
function __destruct() {
43
echo __CLASS__ . "::" . __FUNCTION__ . "\n";
48
echo "Testing class base\n";
51
echo "Testing class derived\n";