how to ignore repeated values in an array.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mahmood
Forum Newbie
Posts: 8
Joined: Fri Mar 19, 2004 5:23 pm

how to ignore repeated values in an array.

Post by mahmood »

say i have an array like this:
myarray[0]= 1 ;
myarray[1]= 3 ;
myarray[2]= 1 ;
myarray[3]= 2 ;
myarray[4]= 2 ;
myarray[4]= 1 ;
now i need a way to list just not repeated values. in this example i need:
myarray[0] which is 1
myarray[1] which is 3
myarray[3] which is 2

how do i achive this?
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Browsing around in the Manual for a particular function that you need, but don't know exists is always a good idea.

You can download a copy for yourself from the link in my signature.

I recommend the "Windows CHM" file. :)
Post Reply