24.2 Answers to Chapter 3This is NOT the latest copy of this book; click here for the latest version.
-
"Which of the following are not valid variables", the answer is "d" - variables may not start with a number.
-
"What will $foo be set to in this expression: $foo = "wombat" * 2 The answer is 0, because a string multiplied by an integer will yield 0.
-
"What will $bar be set to in this expression: $bar = 5 * 5 + 5 The answer is 30, because multiplication takes precedence over addition, meaning that the 5 * 5 is done first, giving 25, then 5 is added, giving 30.
-
"What does the =< operator do?" The answer is: terminate PHP. This is because there is a <= operator meaning "less than or equal to", but there is no =< operator, so PHP will exit saying, "parse error, unexpected '<'. Trick question - sorry!
-
"How does OR different from ||" - || is a higher priority operator than OR, meaning it gets evaluated sooner.
-
"The superglobal array variables are accessible..." can be answered only by "e". Well, if you were listening, that is!
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|