summaryrefslogtreecommitdiff
path: root/tests/classes/ctor_dtor.phpt
blob: 3a40f7f5688bb161246ddfbef5fbceb21303d59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--TEST--
ZE2 The new constructor/destructor is called
--FILE--
<?php

class early {
    function __construct() {
        echo __CLASS__ . "::" . __FUNCTION__ . "\n";
    }
    function __destruct() {
        echo __CLASS__ . "::" . __FUNCTION__ . "\n";
    }
}

class late {
    function __construct() {
        echo __CLASS__ . "::" . __FUNCTION__ . "\n";
    }
    function __destruct() {
        echo __CLASS__ . "::" . __FUNCTION__ . "\n";
    }
}

$t = new early();
$t->__construct();
unset($t);
$t = new late();
//unset($t); delay to end of script

echo "Done\n";
?>
--EXPECT--
early::__construct
early::__construct
early::__destruct
late::__construct
Done
late::__destruct