php - How can I access my classe's var inside the class? -
i have class:
class myclass { public $a = 'blablabla'; }
and want access variable $a
inside class without needing use function, like
class myclass { public $a = 'blablabla'; public $b = $a; }
i tried using public $b = $this->a
, public $b = myclass->a
, , many other alternative ways try want, , nothing. , didn't find on google explain want.
could please me? thanks.
i not sure why simple variable call not work, can try:
class myclass { public $a = 'blablabla'; function geta(){ return $this->a; } $b=geta(); }
Comments
Post a Comment