What will the following PHP code print?

<?php
$data = [[1, 2], [3, 4]];
echo is_array($data[0]) ? "Array" : "Not Array";
?>
                        

Options

  • A. 1
  • B. Not Array
  • C. Array
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Array

Detailed Explanation

Correct Answer: Option C

Explanation:
$data is a multidimensional array. Its first element, $data[0], is itself an array containing 1 and 2. Therefore, is_array($data[0]) returns true and the output is Array.