Zend
200-530 · Question #40
You have been given the following PHP code snippet: <?php $array = array ('1', '2', '3'); foreach ($array as $key => $value) { $value = 4; } print_r($array); ?> What will be the output? Zend 200-530…
The correct answer is C. Array ( [0] => 1 [1] => 2 [2] => 3 ). See the full explanation below for the reasoning.
Question
You have been given the following PHP code snippet: <?php $array = array ('1', '2', '3'); foreach ($array as $key => $value) { $value = 4; } print_r($array); ?> What will be the output? Zend 200-530 Exam
Exhibit
Options
- AArray ( [0] => 4 [1] => 8 [2] => 12 )
- BThe script will throw an error message.
- CArray ( [0] => 1 [1] => 2 [2] => 3 )
- DArray ( [0] => 1 [4] => 2 [8] => 3 )
How the community answered
(35 responses)- A3% (1)
- B6% (2)
- C77% (27)
- D14% (5)
Community Discussion
No community discussion yet for this question.
