A question about function()
Posted: 17 Dec 2020 20:42
Hello, dear forum!
I have the following question:
In the code above how can I get the $a in "echo 3 $a;" to be the same as in the "echo 2 $a;" ?
The problem in other words: I can submit $a from "$a = 0;" through the "func($a);" into the "function func($a){}",
but not backwards from "function func($a){}" to the "echo 3 $a;".
I have the following question:
Code: Select all
$a = 0;
func($a);
echo 3 $a;
function func($a){
echo 1 $a;
$a += 1;
echo 2 $a;
return $a;
}
The problem in other words: I can submit $a from "$a = 0;" through the "func($a);" into the "function func($a){}",
but not backwards from "function func($a){}" to the "echo 3 $a;".