Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 640 Bytes

0107.md

File metadata and controls

40 lines (32 loc) · 640 Bytes

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