note 106147 added to language.oop5.basic

From: Date: Fri, 14 Oct 2011 05:30:21 +0000
Subject: note 106147 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-183870@lists.php.net to get a copy of this message
<?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; } } print Foo::$my_static . "\n"; $foo = new Foo(); print $foo->staticValue() . "\n"; print $foo->my_static . "\n"; // Undefined "Property" my_static print $foo::$my_static . "\n"; $classname = 'Foo'; print $classname::$my_static . "\n"; // As of PHP 5.3.0 print Bar::$my_static . "\n"; $bar = new Bar(); print $bar->fooStatic() . "\n"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 117.241.0.13 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php Edit -- https://master.php.net/note/edit/106147 Del: integrated -- https://master.php.net/note/delete/106147/integrated Del: useless -- https://master.php.net/note/delete/106147/useless Del: bad code -- https://master.php.net/note/delete/106147/bad+code Del: spam -- https://master.php.net/note/delete/106147/spam Del: non-english -- https://master.php.net/note/delete/106147/non-english Del: in docs -- https://master.php.net/note/delete/106147/in+docs Del: other reasons-- https://master.php.net/note/delete/106147 Reject -- https://master.php.net/note/reject/106147 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#183870) next »