note 60420 added to function.array-diff

From: Date: Fri, 06 Jan 2006 12:22:04 +0000
Subject: note 60420 added to function.array-diff
Groups: php.notes 
Request: Send a blank email to php-notes+get-101302@lists.php.net to get a copy of this message
After spending half an hour scratching my head wondering why this function wasn't working I realised I had the arguments the wrong way round! I needed to remove the contents of $array1 from $array2 so I tried: <?php $diff = array_diff($members1, $members2); ?> WRONG!! A quick swap around and things worked smoothly... <?php $diff = array_diff($members2, $members1); ?> Hope this saves someone a bit of bother ---- Manual Page -- http://www.php.net/manual/en/function.array-diff.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60420 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60420&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60420&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101302) next »