note 86054 rejected from language.oop5.static by thiago
| From: | thiago@php.net | Date: | Wed, 01 Oct 2008 13:07:13 +0000 |
| Subject: | note 86054 rejected from language.oop5.static by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-144929@lists.php.net to get a copy of this message | ||
Note Submitter: smilesrg at ukr dot net
----
The example doesn't work (PHP 5.2.4).
"syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM"
here: print $foo::$my_static . "\n";
and here: print $classname::$my_static . "\n";
Please, check examples before adding to documentation.
<?php
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
phpinfo();
print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Ðе опÑеделено
ÑвойÑÑво my_static
print $foo::$my_static . "\n";
$classname = 'Foo';
print $classname::$my_static . "\n"; // ÐаÑинаÑ
ÑолÑко Ñ PHP 5.3.0
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n";
?>