note 43272 deleted from function.array-unique by sobak
| From: | sobak@php.net | Date: | Sun, 11 Dec 2016 06:52:46 +0000 |
| Subject: | note 43272 deleted from function.array-unique by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208479@lists.php.net to get a copy of this message | ||
Note Submitter: wernerlistas at terra dot com dot br
----
Following the code copies of a little function I've wrote that actually works with
multidimensional arrays.
It also resets the array indexes.
<?php
if ( !function_exists( "arrayUnique" ) ){
function arrayUnique ( $rArray ){
$rReturn = array ();
while ( list( $key, $val ) = each ( $rArray ) ){
if ( !in_array( $val, $rReturn ) )
array_push( $rReturn, $val );
}
return $rReturn;
}
}
?>