Google

Saturday, January 23, 2010

How to get unique value form PHP array?


array_unique()


(PHP 4 >= 4.0.1, PHP 5)

array_unique — Removes duplicate values from an array

Description:

Takes an input array and returns a new array without duplicate values.

Note that keys are preserved. array_unique() sorts the values treated as string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the unsorted array will be kept.

Example:


/*= array("a" => "1", "2", "3" => "1", "2", "3");
$result = array_unique($input);
print_r($result);
*/

Result:
/*Array
(
[a] => 1
[0] => 2
[2] => 3
)*/



16 comments:

allena said...

its working........

---------------
Poker Online

allena said...

thanks for this post its helps me very much.

--------------
free casino comps

peter north said...

Working fine for me as well. Thanks

vintage desinger bags

peter north said...

Keep doing good work. You are not updating your blog.

online poker community

allena said...

Hello,

Your Blogging techniques are very good and you are providing the knowledge in very light way, I have bookmarked your blog, Keep it up.

--------------
Leadership development

Cool Administrator said...

PHP is the wonder of all technologies. Despite it's age people still find more and more ways how to execute it.

iPhone 4S Jailbreak

pokercodes said...

Awesome article. They completely refresh my mind. Thanks a lot for sharing.

---------------

Bodog Poker Review

pokercodes said...

Interesting and important information. It is really beneficial for us. Thanks

----------------

party casino bonus code

pokercodes said...

Awesome article. They completely refresh my mind. Thanks a lot for sharing.

-----------------

Winner Casino Review

pokercodes said...

Awesome article. They completely refresh my mind. Thanks a lot for sharing.

---------------

online poker community

Aanya said...

Hello,

Very useful and informative content has been shared, I must say that your writing skills are very attractive. Moreover sharing information and acknowledging others is really very good job, keep it up.
----------------------
poker forum

sabreena said...

Wow. Fantastic article, it’s so nice and your blog is very good.
I've learned a lot from your blog here, you’re provided blog is very super perfect i really like it. Keep it up and Thanks you for sharing......!



-----------------

android poker

sabreena said...

You write really good articles, very attractive, I feel very shocked. I hope you can continue with your work, come on!


--------------

iphone bingo

sabreena said...

Nice post love your blog.This blog is awesome full of use full information that i was in dire need of. Thanks for this post. Keep it up.



-------------

iphone black jack

sabreena said...

Great compilation. Thanks for inspiring. Keep it going



--------------

iphone slots

sabreena said...

Thanks for sharing with us this tip . I’ll use this anti spyware to see if it’s good . I always had problems with spywares , that is already a part of this internet ….



--------------

android poker