note 91792 added to function.array-unique

From: Date: Thu, 25 Jun 2009 15:57:10 +0000
Subject: note 91792 added to function.array-unique
Groups: php.notes 
Request: Send a blank email to php-notes+get-157499@lists.php.net to get a copy of this message
In response to the note made by steve at visual77 dot com on 26-May-2009 11:41, md5 may be too slow if you have great amount of elements in the array. Instead you may want to use CRC32 instead of MD5 for hashing the key. <?php $values = array(); foreach($data as $d) { $values[dechex(crc32(serialize($d)))] = $d; } sort($values); ?> The result would still be same, but using CRC32 would make things a tad faster. ---- Server IP: 64.71.164.2 Probable Submitter: 218.186.10.250 (proxied: 116.88.224.11) ---- Manual Page -- http://www.php.net/manual/en/function.array-unique.php Edit -- https://master.php.net/note/edit/91792 Del: integrated -- https://master.php.net/note/delete/91792/integrated Del: useless -- https://master.php.net/note/delete/91792/useless Del: bad code -- https://master.php.net/note/delete/91792/bad+code Del: spam -- https://master.php.net/note/delete/91792/spam Del: non-english -- https://master.php.net/note/delete/91792/non-english Del: in docs -- https://master.php.net/note/delete/91792/in+docs Del: other reasons-- https://master.php.net/note/delete/91792 Reject -- https://master.php.net/note/reject/91792 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157499) next »