What is the output of the following code?
What is the output of the following code? $a = 3; switch ($a) { case 1: echo ‘one’; break; case 2: echo ‘two’; break; default: echo ‘four’; break; case 3: echo ‘three’; break; } A. one B. two C. three…
What is the output of the following code? $a = 3; switch ($a) { case 1: echo ‘one’; break; case 2: echo ‘two’; break; default: echo ‘four’; break; case 3: echo ‘three’; break; } A. one B. two C. three…
What is "instanceof" an example of? A. a boolean B. an operator C. a function D. a language construct E: a class magic
Which of the following may be used in conjunction with CASE inside a SWITCH statement? A. A scalar B. An expression C. A boolean D. All of the above
What is the output of the following code? $a = ‘a’; $b = ‘b’; echo isset($c) ? $a.$b.$c : ($c = ‘c’).’d’; A. abc B. cd C. 0d
Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2) $obj = new C(); foreach ($obj as $x => $y) { echo $x, $y; } A. Iterator B. ArrayAccess C.…
What is the output of the following code? class Foo Implements ArrayAccess { function offsetExists($k) { return true;} function offsetGet($k) {return ‘a’;} function offsetSet($k, $v) {} function offsetUnset($k) {} } $x = new Foo(); echo array_key_exists(‘foo’, $x)?’true’:’false’; A. true B.…
What is the output of the following code? class Bar { private $a = ‘b’; public $c = ‘d’; } $x = (array) new Bar(); echo array_key_exists(‘a’, $x) ? ‘true’ : ‘false’; echo ‘-‘; echo array_key_exists(‘c’, $x) ? ‘true’ :…
What is the output of the following code? $a = array(‘a’, ‘b’=>’c’); echo property_exists((object) $a, ‘a’)?’true’:’false’; echo ‘-‘; echo property_exists((object) $a, ‘b’)?’true’:’false’; A. false-false B. false-true C. true-false D. true-true
What is the output of the following code? echo ‘1’ . (print ‘2’) + 3; A. 123 B. 213 C. 142 D. 214 E: Syntax error
Which of the following PHP values may NOT be encoded to a JavaScript literal using PHP’s ext/json capabilities? A. ‘Hello, world!’ B. function(){ alert("Hello, world!"); } C. array(‘Hello, world!’) D. array(‘message’ => ‘Hello, world!’)