?
What will be the output of the following PHP code?
What will be the output of the following PHP code?
<?php
$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");
$a2 = array("e" => "red", "f" => "green", "g" => "blue", "h" => "orange");
$a3 = array("i" => "orange");
$a4 = array_combine($a2, $a3);
$result = array_diff($a4, $a2);
print_r($result);
?>
<?php
$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");
$a2 = array("e" => "red", "f" => "green", "g" => "blue", "h" => "orange");
$a3 = array("i" => "orange");
$a4 = array_combine($a2, $a3);
$result = array_diff($a4, $a2);
print_r($result);
?>
Answer & Solution
Correct Answer:
Option
A
The array_diff() function compares the values of two (or more) arrays, and returns the differences.
Join the Discussion
Login to post a comment or share your explanation.
LoginArray ( [i] => orange )
because the array_diff is not between $a4 and $a1
array_combine() give warning if both array's parameter have not same.
many of question's answer are wrong. Please check it.
array_combine() give warning if both array's parameter have not same.
many of question's answer are wrong. Please check it.