In the following code I want to echo green outside of public function.
Public function lol(){
$green ="green";
}
for example i want to echo $green in the following code.
public function green(){
echo"this is $green";
}
In the following code I want to echo green outside of public function.
Public function lol(){
$green ="green";
}
for example i want to echo $green in the following code.
public function green(){
echo"this is $green";
}
You pass $green in as a parameter and echo the function return value:
function green($green) {
return "This is ". $green;
}
echo green('green'); //Results in: This is green
echo green('yellow'); //Results in: This is yellow