Loading ...
Sorry, an error occurred while loading the content.

Compare two array and return difference from both array

Expand Messages
  • Ved Prakash
    Hi Shiva, check this out. greenss , b = brown , c = asdfsad , e = asdfsad , p = asdfsad ); $array2 = array( a =
    Message 1 of 6 , Apr 6, 2010
    • 0 Attachment
      Hi Shiva,

      check this out.

      <?php
      $array1 = array("a" => "greenss", "b" => "brown", "c" => "asdfsad","e" =>
      "asdfsad","p" => "asdfsad");
      $array2 = array("a" => "green", "b" => "brown", "c"=>"shiva","d"
      =>"red","e" => "asdfsad");
      $resarr = array_keys(array_diff_assoc($array1, $array2));
      $resarr2 = array_keys(array_diff_assoc($array2, $array1));
      $narr = array_unique(array_merge($resarr,$resarr2));
      print_r($narr);
      ?>

      - Ved


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.