note 91812 added to function.array-diff

From: Date: Fri, 26 Jun 2009 13:24:18 +0000
Subject: note 91812 added to function.array-diff
Groups: php.notes 
Request: Send a blank email to php-notes+get-157530@lists.php.net to get a copy of this message
Ops! The last function have a little mistake (it was inside a object, there´s a $this call..), here is the correct: <?php function arrayRecursiveDiff($aArray1, $aArray2) { $aReturn = array(); foreach ($aArray1 as $mKey => $mValue) { if (array_key_exists($mKey, $aArray2)) { if (is_array($mValue)) { $aRecursiveDiff = arrayRecursiveDiff($mValue, $aArray2[$mKey]); if (count($aRecursiveDiff)) { $aReturn[$mKey] = $aRecursiveDiff; } } else { if ($mValue != $aArray2[$mKey]) { $aReturn[$mKey] = $mValue; } } } else { $aReturn[$mKey] = $mValue; } } return $aReturn; } ?> ---- Server IP: 187.16.23.134 Probable Submitter: 189.4.84.138 ---- Manual Page -- http://www.php.net/manual/en/function.array-diff.php Edit -- https://master.php.net/note/edit/91812 Del: integrated -- https://master.php.net/note/delete/91812/integrated Del: useless -- https://master.php.net/note/delete/91812/useless Del: bad code -- https://master.php.net/note/delete/91812/bad+code Del: spam -- https://master.php.net/note/delete/91812/spam Del: non-english -- https://master.php.net/note/delete/91812/non-english Del: in docs -- https://master.php.net/note/delete/91812/in+docs Del: other reasons-- https://master.php.net/note/delete/91812 Reject -- https://master.php.net/note/reject/91812 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157530) next »