What is the output of the following code?
$first = "second";
$second = "first";
echo $$$first;
Late static binding is used in PHP to:
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 will the following code print out?
$str = '✔ one of the following';
echo str_replace('✔', 'Check', $str);
What will be the output value of the following code?
$array = array(1,2,3);
while (list(,$v) = each($array));
var_dump(current($array));
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;