National_Instruments
200-500 · Question #119
What is the output of the following code? 1 <?php 2 function append($str) 3 { 4 $str = $str.'append'; 5 } 7 function prepend(&$str) 8 { 9 $str = 'prepend'.$str; 10 } 12 $string = 'zce'; 13…
The correct answer is C. prependzce. See the full explanation below for the reasoning.
Question
What is the output of the following code? 1 <?php 2 function append($str) 3 { 4 $str = $str.'append'; 5 } 7 function prepend(&$str) 8 { 9 $str = 'prepend'.$str; 10 } 12 $string = 'zce'; 13 append(prepend($string)); 14 echo $string; 15 ?>
Options
- Azceappend
- Bprependzceappend
- Cprependzce
- Dzce
How the community answered
(39 responses)- A5% (2)
- B8% (3)
- C85% (33)
- D3% (1)
Community Discussion
No community discussion yet for this question.