How to echo something outside of function?

try the following code :

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

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

Place the $green variable in constructor.

Leave a Comment