What is the output of this PHP code?

<?php
$numbers = [10, 20, 30, 40];
echo $numbers[2];
?>
                        

Options

  • A. 10
  • B. 20
  • C. 30
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. 30

Detailed Explanation

Correct Answer: Option C

Explanation:
Indexed arrays in PHP commonly start with index 0. Therefore, index 0 contains 10, index 1 contains 20, and index 2 contains 30.