Thread: hi all
View Single Post

  #2 (permalink)  
Old 07-16-2003
Will Dowling
 
Posts: n/a
Default Re: hi all

> Im printing out a list of arrays into screen, however i only want items
that
> are unique to be printed... so i dont get double items to be printed...

how
> do i go about that?


array_unique() - Removes duplicate values from an array

It's in the PHP manual under "Array Functions".
It returns the new array, so you'd just have to do something like this:

<?php

$myArray = array(
"big",
"badda",
"boom"
);

$tempArray = array_unique( $myArray );
print_r( $tempArray );

?>

Hope this helps :)


- Will Dowling



Reply With Quote