2
ZE2 factory and singleton, test 2
4
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
10
static private $test = NULL;
11
static private $cnt = 0;
13
static function factory($x) {
17
test::$test = new test($x);
22
protected function __construct($x) {
27
static function destroy() {
31
protected function __destruct() {
35
public function get() {
39
static public function getX() {
41
return test::$test->x;
47
static public function count() {
52
echo "Access static members\n";
53
var_dump(test::getX());
54
var_dump(test::count());
56
echo "Create x and y\n";
57
$x = test::factory(1);
58
$y = test::factory(2);
59
var_dump(test::getX());
60
var_dump(test::count());
66
var_dump(test::getX());
67
var_dump(test::count());
72
var_dump(test::getX());
73
var_dump(test::count());
75
//echo "Destruct static\n";
77
//var_dump(test::getX());
78
//var_dump(test::count());
100
Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0