<<< Previous question <<< Question ID#0107.md >>> Next question >>>
You have been given the following PHP code snippet:
$array = array('1', '2', '3');
foreach($array as $key => $value) {
$value = 4;
}
print_r($array);
What will be the output?
- A)
Array ( [0] => 1 [1] => 2 [2] => 3 )
- B)
# The script will throw an error message.
- C)
Array ( [0] => 4 [1] => 8 [2] => 12 )
- D)
Array ( [0] => 1 [4] => 2 [8] => 3 )
Answer
Answer: A