function admin_array_diff

7.x admin.groups.inc admin_array_diff($array1, $array2)
6.x admin.groups.inc admin_array_diff($array1, $array2)
4.x admin.groups.inc admin_array_diff($array1, $array2)
5.x admin.groups.inc admin_array_diff($array1, $array2)

I had to create my own version of array_diff, because the built-in PHP version has a nasty bug where it doesn't work after a certain number of elements.

1 call to admin_array_diff()

File

modules/admin/admin.groups.inc, line 936

Code

function admin_array_diff($array1, $array2) {


  // Return an array of values from array1 that
  // are NOT in array2.
  // This is my (Richard Peacock) own implementation of array_diff,
  // because something is broken with it, so I am programming
  // my own.
  $rtn = array();
  //for ($t = 0; $t < count($array1); $t++)
  // MUST use foreach instead of for(count($arr))
  // because I did array_unique on it!
  foreach ($array1 as $t => $value) 
   {
    if (in_array($array1 [$t], $array2)) 
     {
      continue;
    }
    else {
      $rtn [] = $array1 [$t];
    }
  }
  return $rtn;

}