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
Post a Comment