Multi-dimensional arrays PHP

Tags:
Arrays
PHP
How can I remove duplicates from the resulting array:
$flavors =array( 'blue raspberry', 'root beer','root beer');

$two=array("fish","boy",'root beer') ;
$result = array_map(null,$flavors,$two);
$no_duplicates =array_map("unserialize", array_unique(array_map("serialize", $result)));
when I run the code i get this:
Array ( [0] => Array ( [0] => blue raspberry [1] => fish ) [1] => Array ( [0] => root beer [1] => boy ) [2] => Array ( [0] => root beer [1] => root beer ) )
I want to remove the repeated root beer, root beer part from the resulting array.


Software/Hardware used:
php 5+
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Take a look at http://stackoverflow.com/questions/13922633/php-remove-duplicates-based-on-first-value-of-multidimensional-array

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: