note 64454 added to function.array-unique

From: Date: Fri, 14 Apr 2006 16:02:51 +0000
Subject: note 64454 added to function.array-unique
Groups: php.notes 
Request: Send a blank email to php-notes+get-108090@lists.php.net to get a copy of this message
The shortest way i found to remove duplicate array from a column, For example if you parse Multiple XML sources, you can remove duplicate items that contain the same link. <?PHP function remove_duplicate($array, $field) { foreach ($array as $sub) $cmp[] = $sub[$field]; $unique = array_unique($cmp); foreach ($unique as $k => $rien) $new[] = $array[$k]; return $new; } ?> ---- Server IP: 195.221.21.36 Probable Submitter: 82.240.34.84 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-unique.php Edit -- http://master.php.net/note/edit/64454 Del: integrated -- http://master.php.net/note/delete/64454/integrated Del: useless -- http://master.php.net/note/delete/64454/useless Del: bad code -- http://master.php.net/note/delete/64454/bad+code Del: spam -- http://master.php.net/note/delete/64454/spam Del: non-english -- http://master.php.net/note/delete/64454/non-english Del: in docs -- http://master.php.net/note/delete/64454/in+docs Del: other reasons-- http://master.php.net/note/delete/64454 Reject -- http://master.php.net/note/reject/64454 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#108090) next »