Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print Foo::$my_static
- $classname = 'Foo';
- print $classname::$my_static
- 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::$my_static . "n";
- $classname = 'Foo';
- print $classname::$my_static . "n"; // As of PHP 5.3.0
- ?>
- <?php
- class Foo{
- static $myVar="foo";
- public static function aStaticMethod(){
- return self::$myVar;
- }
- }
- $foo=new Foo;
- print $foo->aStaticMethod();
- ?>
Add Comment
Please, Sign In to add comment