php - How to echo something outside of function? -


in following code want echo green outside of public function.

public function lol(){ $green ="green"; } 

for example want echo $green in following code.

public function green(){ echo"this $green"; } 

try following code :

function __construct() {        parent::__construct();        $green ="green";    }  public function green(){ echo"this $green"; } 

place $green variable in constructor.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -