What will be the output of the following PHP code?
<?php
function getData() {
return ["PHP", "C++"];
}
$result = getData();
echo is_array($result) ? "Array" : "Not Array";
?>
Options
-
A.
PHP
-
B.
C++
-
C.
Not Array
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
E.
None of the above
Detailed Explanation
Correct Answer: Option DExplanation:The function
getData() returns an array containing PHP and C++. Therefore,
is_array($result) returns true and the output is
Array. Since none of options A, B, or C states this output, Option E should be correct instead.