Vidyalelo
PHP · Q43

Arrays

Programming · PHP · question 43

Q43

What will be the output of the following PHP code?

A.
Array ( [0] => KA [1] => LA [2] => CA [3] => MA [4] => TA [5] => IA [6] => GA )
B.
Array ( [0] => KA [2] => CA [4] => TA )
Answer
C.
Array ( [1] => IA [3] => GA )
D.
Array ( [1] => LA [3] => MA )

Answer: Option B

Solution

Answer: Option B
Solution:
The array_intersect() function returns a key preserved array consisting only of those values present in the first array that are also present in each of the other input arrays.