Find out the difference of arrays – PHP

<?php
 $testArray1 = array("key1" => "val1", "key2" => "val2", "val4");
 $testArray2 = array("key4" => "val3", "val2", "val7");
 $testArray3 = array_diff($testArray1, $testArray2);
 print_r($testArray3);// Array ( [key1] => val1 [0] => val4 )
?>

Leave a Reply

Your email address will not be published. Required fields are marked *