Zend 200-550 - Zend Certified PHP Engineer
Consider the following code. What change must be made to the class for the code to work as written?
class Magic {
protected $v = array("a" => 1, "b" => 2, "c" => 3);
public function __get($v) {
return $this->v[$v];
}
}
$m = new Magic();
$m->d[] = 4;
echo $m->d[0];
What is the name of the PHP function used to automatically load non-yet defined classes?
SimpleXML provides the ability to iterate over items in an XML document, as well as access items within it as if they were object properties. When creating your own classes to access data, implementing which of the following would NOT achieve this goal?
Type hinting in PHP allows the identification of the following variable types: (Choose 2)
When a browser requests an image identified by an img tag, it never sends a Cookie header.
What is the output of the following code?
echo '1' . (print '2') + 3;
In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)
What is the preferred method for preventing SQL injection?
What is the result of the following code?
define('PI', 3.14);
class T
{
const PI = PI;
}
class Math
{
const PI = T::PI;
}
echo Math::PI;
What is the output of the following code?
class A {
public $a = 1;
public function __construct($a) { $this->a = $a; }
public function mul() {
return function($x) {
return $this->a*$x;
};
}
}
$a = new A(2);
$a->mul = function($x) {
return $x*$x;
};
$m = $a->mul();
echo $m(3);