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

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -