Home > PHP > PHP Remove Duplicate Array Values From Multidimentional Array

PHP Remove Duplicate Array Values From Multidimentional Array

    PHP Remove Duplicate Array Values From Multidimentional Array

$inputArray =

Array
(
[0] => Array
(
[0] => 1
[1] => 3
[2] => 6
)

[1] => Array
(
[0] => 2
[1] => 5
)

[2] => Array
(
[0] => 1
[1] => 3
[2] => 6
)

[3] => Array
(
[0] => 2
[1] => 5
)

[4] => Array
(
[0] => 1
[1] => 3
[2] => 6
)

)

$input = array_map(“unserialize”, array_unique(array_map(“serialize”, $inputArray)));

/******** Output *************/

Array
(
[0] => Array
(
[0] => 1
[1] => 3
[2] => 6
)

[1] => Array
(
[0] => 2
[1] => 5
)

)

/*********************** end make unique array *********************/

Advertisements
Categories: PHP Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: