note 8297 added to array_unique
| From: | sterba at locksley-west dot com | Date: | Tue, 05 Sep 2000 04:30:14 +0000 |
| Subject: | note 8297 added to array_unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4157@lists.php.net to get a copy of this message | ||
Maybe this will come handy for PHP3 users:
for ($a = 0; $a<$arraylength; $a++){
if (($a>0)&&($array[$a]<>$array[$a-1])) $uniquearray[$a]=$array[$a];}
You can even skip the $a>0 test, I believe... not bulletproof, but much shorter.
http://www.php.net/manual/function.array-unique.php