Hello forums!!
I had the following code running under the php5 server(With E_STRICT error reporting)
Code:
<?php
class Test{
private static $list;
private function __construct(){
}
public static function set_msg($msg)
{
self::$list[] = $msg;
}
public static function reset_msg()
{
unset(self::$list);
}
public static function get_msg()
{
return self::$list;
}
public static function test1(msg)
{
self::set_msg($msg);
}
public static function test2(msg)
{
self::set_msg($msg);
}
}
?>
Accessing portion:
<?php
// including class goes here..
Test::test1("Message1");
Test::test2("Message2");
print_r(Test::get_msg());
Test::reset_msg(); // this gives the error : "Fatal error: Attempt to unset static property Test::$list"
?>
Why did such error occur ? I didnt get any idea. Can anybody give a hint ?
Thanks in advance to all of you