Vidyalelo
PHP · Q16

Arrays

Programming · PHP · question 16

Q16

What will be the output of the following PHP code?

A.
Sam is the brother of Bob and Jack
B.
Sam is the brother of Bob and Bob)
Answer
C.
Sam is the brother of Jack and Bob)
D.
Error

Answer: Option B

Solution

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