Answers to Chapter 3
-
"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!
Next chapter: Answers to Chapter 4 >>
Previous chapter: Answers to Chapter 2
Jump to:
Home: Table of Contents



Copyright 2012 Future Publishing Limited (company
registered number 2008885), a company registered
in England and Wales whose registered office is at
Beauford Court, 30 Monmouth Street, Bath, BA1 2BW, UK