hi all

This is a discussion on hi all within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Im printing out a list of arrays into screen, however i only want items that are unique to be printed... ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-16-2003
Spiderman
 
Posts: n/a
Default 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?


thanks guys.



Reply With Quote
  #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
  #3 (permalink)  
Old 07-16-2003
Spiderman
 
Posts: n/a
Default Re: hi all

or should i say ... need one for a multi dimensional array
"Spiderman" <darksheep0@hotmail.com> wrote in message
news:3f14bac1$1@funnel.arach.net.au...
> 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?
>
>
> thanks guys.
>
>
>



Reply With Quote
  #4 (permalink)  
Old 07-16-2003
Spiderman
 
Posts: n/a
Default Re: hi all

nevermind guys. i figured it out...

but thanks anyway.. aventhough no reply yet :P hehe

"Spiderman" <darksheep0@hotmail.com> wrote in message
news:3f14cb46$1@funnel.arach.net.au...
> or should i say ... need one for a multi dimensional array
> "Spiderman" <darksheep0@hotmail.com> wrote in message
> news:3f14bac1$1@funnel.arach.net.au...
> > 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?
> >
> >
> > thanks guys.
> >
> >
> >

>
>



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:14 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0