We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello This is my code.
phper@phper:~$ boris [1] boris> $books = ['aaa', 'bbb']; // array( // 0 => 'aaa', // 1 => 'bbb' // ) [2] boris> function serveBooks() { [2] *> global $books; [2] *> var_dump($books); [2] *> } [3] boris> serveBooks(); NULL // NULL [4] boris>
The text was updated successfully, but these errors were encountered:
You need to specify that the outer $books variable is global. e.g.
[1] boris> global $books; [2] boris> $books = ['aaa', 'bbb']; // array( // 0 => 'aaa', // 1 => 'bbb' // ) [3] boris> function serveBooks() { [3] *> global $books; [3] *> var_dump($books); [3] *> } [4] boris> serveBooks(); array(2) { [0]=> string(3) "aaa" [1]=> string(3) "bbb" } // NULL
Sorry, something went wrong.
No branches or pull requests
Hello
This is my code.
The text was updated successfully, but these errors were encountered: