note 86054 rejected from language.oop5.static by thiago

From: 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"; ?>

« previous php.notes (#144929) next »