Posted By

chupzzz on 03/02/12


Tagged

php diff compare


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tux-world


PHP array_diff() full comparison


 / Published in: PHP
 

URL: http://www.php.net/manual/ru/function.array-diff.php#101613

PHP built-in function array_diff($one, $two) working in one-way only: it not will return new elements from $two. This simple function do that.

  1. <?php
  2. function fullArrayDiff($left, $right) {
  3. return array_diff(array_merge($left, $right), array_intersect($left, $right));
  4. }
  5. ?>

Report this snippet  

You need to login to post a comment.