note 86054 added to language.oop5.static

From: Date: Wed, 01 Oct 2008 13:06:31 +0000
Subject: note 86054 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-144928@lists.php.net to get a copy of this message
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"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 194.44.10.106 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- https://master.php.net/note/edit/86054 Del: integrated -- https://master.php.net/note/delete/86054/integrated Del: useless -- https://master.php.net/note/delete/86054/useless Del: bad code -- https://master.php.net/note/delete/86054/bad+code Del: spam -- https://master.php.net/note/delete/86054/spam Del: non-english -- https://master.php.net/note/delete/86054/non-english Del: in docs -- https://master.php.net/note/delete/86054/in+docs Del: other reasons-- https://master.php.net/note/delete/86054 Reject -- https://master.php.net/note/reject/86054 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144928) next »