1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?php class Foo { protected static $bar = 'lorem'; protected $buz = 'ipsum'; public function test() { var_dump( $this->buz ); var_dump( self::$bar ); } } $instance = new Foo; $instance->test(); ?>
1 2
string(5) "ipsum" string(5) "lorem"