nerdexam
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)
  • A
    13% (3)
  • B
    4% (1)
  • C
    74% (17)
  • D
    9% (2)

Topics

#pass by reference#function composition#string concatenation#nested calls

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice