How we access the static property with creating its class object with -> (arrow) operator ?
OR
How to access static property without scope resolution operator (::) ?
How we access the static property with creating its class object with -> (arrow) operator ?
OR
How to access static property without scope resolution operator (::) ?
<?php
class Foo
{
public static $my_static = 'foo';
public static function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public static function fooStatic();
{
return parent::$my_static;
}
public function barStatic();
{
return parent::$my_static;
}
}
Bar::fooStatic();
$foo = new Foo();
print $foo->staticValue() ." this is foo static". "n";
print $foo->$my_static . "n"; // Undefined "Property" my_static
?>