php-src/tests/classes/ctor_dtor.phpt

41 lines
741 B
Plaintext
Raw Normal View History

2003-03-03 11:18:59 +00:00
--TEST--
2003-08-09 14:48:47 +00:00
ZE2 The new constructor/destructor is called
2003-03-03 11:18:59 +00:00
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
--FILE--
<?php
class early {
2015-03-31 14:10:22 +00:00
function __construct() {
2003-03-03 11:18:59 +00:00
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();
2015-03-31 14:10:22 +00:00
$t->__construct();
2003-03-03 11:18:59 +00:00
unset($t);
$t = new late();
//unset($t); delay to end of script
echo "Done\n";
?>
--EXPECTF--
2015-03-31 14:10:22 +00:00
early::__construct
early::__construct
2003-03-03 11:18:59 +00:00
early::__destruct
late::__construct
Done
late::__destruct