Sometimes we need to find the difference between arrays
In php there is a inbuilt function to find the difference between array.
For example :
<?php
$a1=array(0=>"Apple",1=>"Honda",2=>"Scoda");
$a1=array(0=>"Apple",1=>"Honda",2=>"Scoda");
$a2=array(3=>"Scoda",4=>"Honda",5=>"Ford");
print_r(array_diff($a1,$a2));
?>
The output of the code above will be:
Array ( [0] => Apple )
Comments
Post a Comment