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

1581Compare two array and return difference from both array

Expand Messages
  • Ved Prakash
    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]
    • Show all 6 messages in this topic