ExamVeda
Login
Home
This question belongs to PHP Arrays
Arrays
?

What will be the output of the following PHP code?
<?php
$names = array("Sam", "Bob", "Jack");
echo $names[0] . "is the brother of " . $names[1] . " and " . $names[1] . ".";
?>

Answer & Solution
Correct Answer: Option B
Simple definition of array and using it in a string. We have used $names[1] twice and hence Bob appears twice.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.