Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 577 Bytes

0517.md

File metadata and controls

21 lines (17 loc) · 577 Bytes

What is the output of the following code block?

$array = array(1 => 0, 2, 3, 4);
array_splice($array, 3, count($array), array_merge(array('x'), array_slice($array, 3))); 
var_dump($array);
  • A) 0 => 0, 1 => 2, 2 => 3, 3 => x, 4 => 4
  • B) 1 => 1, 2 => 2, 3 => x, 4 => 4
  • C) 0 => 1, 2 => 2, 3 => 3, 4 => 4, x => 3
  • D) 0 => x, 1 => 0, 2 => 1, 3 => 2, 4 => 3
Answer

Answer: A