note 91792 deleted from function.array-unique by danbrown
| From: | danbrown@php.net | Date: | Thu, 25 Jun 2009 16:04:39 +0000 |
| Subject: | note 91792 deleted from function.array-unique by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157501@lists.php.net to get a copy of this message | ||
Note Submitter: Sam Yong - hellclanner at live dot com
----
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.