note 38344 deleted from function.array-diff-assoc by aidan

From: Date: Wed, 09 Jun 2004 10:18:53 +0000
Subject: note 38344 deleted from function.array-diff-assoc by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70574@lists.php.net to get a copy of this message
Note Submitter: jochem@iamjochem.com ---- here is a slightly enhanced version of Micheal Johnsons function (posted 26.oct.2003), this version accepts arguments in the same way as array_diff_assoc (i.e. you can pass as many arrays as you want - any arguments that are not arrays are ignored). If the first argument is not an array you automatically get empty array back: <? function array_diff_assoc() { $args = func_get_args(); $res = $args[0]; if(!is_array($res)) { return array(); } for($i=1;$i<count($args);$i++) { if(!is_array($args[$i])) { continue; } foreach ($args[$i] as $key => $data) { unset($res[$key]); } } return $res; } ?>

« previous php.notes (#70574) next »