What will be the output of the following PHP code?

<?php
$user = ["name" => "Amit", "age" => 25];
echo is_array($user) ? "Yes" : "No";
?>
                        

Options

  • A. Yes
  • B. No
  • C. 25
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. Yes

Detailed Explanation

Correct Answer: Option A

Explanation:
An associative array is still an array in PHP. The variable $user stores key-value pairs, so is_array($user) returns true and the code prints Yes.