What is the output of the following code?
What is the output of the following code? function append($str) { $str = $str.’append’; }
function prepend(&$str) { $str = ‘prepend’.$str; } $string = ‘zce’; append(prepend($string));
echo $string;
What is the output of the following code?
What is the output of the following code? function increment ($val) { $val = $val + 1; } $val =
1; increment ($val); echo $val;
What is the output of the following code?
What is the output of the following code? function increment ($val) { ++$val; } $val = 1;
increment ($val); echo $val;
What is the output of the following code?
What is the output of the following code? function increment ($val) { $_GET[‘m’] = (int)
$_GET[‘m’] + 1; } $_GET[‘m’] = 1; echo $_GET[‘m’];
How many times will the function counter() be executed in the following code?
How many times will the function counter() be executed in the following code? function
counter($start, &$stop) { if ($stop > $start) { return; } counter($start–, ++$stop); } $start = 5;
$stop = 2; counter($start, $stop);
How do you allow the caller to submit a variable number of arguments to a function?
How do you allow the caller to submit a variable number of arguments to a function?
What will the $array array contain at the end of this script?
What will the $array array contain at the end of this script? function modifyArray (&$array) {
foreach ($array as &$value) { $value = $value + 1; } $value = $value + 2; } $array = array (1,
2, 3); modifyArray($array);
What is the output of the following code?
What is the output of the following code? class a { public $val; } function renderVal (a $a) { if
($a) { echo $a->val; } } renderVal (null);
What is the output of the following code?
What is the output of the following code? function fibonacci (&$x1 = 0, &$x2 = 1) { $result =
$x1 + $x2; $x1 = $x2; $x2 = $result; return $result; } for ($i = 0; $i < 10; $i++) { echo
fibonacci() . ‘,’; }
What is the output of the following code?
What is the output of the following code? function ratio ($x1 = 10, $x2) { if (isset ($x2)) {
return $x2 / $x1; } } echo ratio (0);