- 1
Where is error? I want '6 Yes' as output.
4 Respostas
+ 5
"Notice: Undefined variable: answer...."
It looks like $answer is not a global variable. It's local to the function, created and destroyed there.
Putting a line break at line 5 between } and the function call may assist as a visual separation of 'variable scope'.
+ 1
Check this
https://code.sololearn.com/w3zoxw3Ll9Al
+ 1
global $answer; <-- put this in your func
+ 1
Try this
Function with global variable in php
https://code.sololearn.com/w3zoxw3Ll9Al/#php