var inside var in oop php -


im biginner in object oriented programming , learning object oriented php , have got bit confused including variable inside variable inside of class, like:

$div_content="some content"; $div = '<div>'.$div_content.'</div>'; 

but when trying this, error:

class someclass{  private $div_content ="some content"; public $div='<div>'.$div_content.'</div>';  function __construct(){  echo $this->div;  }  } 

can 1 please me understand im doing wrong here? in advance.

 function __construct(){   $this->div = '<div>'.$this->div_content.'</div>';   echo $this->div;  } 

you can define static values on declarations, use __construct() it


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -