note 106147 deleted from language.oop5.basic by danbrown

From: Date: Fri, 14 Oct 2011 19:30:19 +0000
Subject: note 106147 deleted from language.oop5.basic by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183891@lists.php.net to get a copy of this message
Note Submitter: ganesh at gmail dot com ---- <?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"; ?>

« previous php.notes (#183891) next »