Zend
200-710 · Question #84
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;
The correct answer is C. prependzce. See the full explanation below for the reasoning.
Functions
Question
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;
Options
- Azceappend
- Bprependzceappend
- Cprependzce
- Dzce
How the community answered
(23 responses)- A13% (3)
- B4% (1)
- C74% (17)
- D9% (2)
Topics
#pass by reference#function composition#string concatenation#nested calls
Community Discussion
No community discussion yet for this question.