note 22446 added to function.define
| From: | purikk at hotmail dot com | Date: | Tue, 18 Jun 2002 17:04:03 +0000 |
| Subject: | note 22446 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31982@lists.php.net to get a copy of this message | ||
Even static does'nt meem to be working
///////////////////////
<?php
class Counter {
var $counter = 0;
function increment_and_print()
{
print ++$this->counter;
print "\n";
}
}
class SingletonCounter {
static $m_instance = NULL;
function Instance()
{
if (self::$m_instance == NULL) {
self::$m_instance = new Counter();
}
return self::$m_instance;
}
}
SingletonCounter::Instance()->increment_and_print();
SingletonCounter::Instance()->increment_and_print();
SingletonCounter::Instance()->increment_and_print();
?>
/////////////////////////
Parse error: parse error, expecting
T_OLD_FUNCTION' or T_FUNCTION' or
T_VAR' or '}'' in /singleton.php on line 15
--
http://www.php.net/manual/en/function.define.php
http://master.php.net/manage/user-notes.php?action=edit+22446
http://master.php.net/manage/user-notes.php?action=delete+22446
http://master.php.net/manage/user-notes.php?action=reject+22446