I have an array like this-
Array
(
[0] => Array
(
[size] => 12" x 24"
[size_description] => <p>Rectified</p>
)
[1] => Array
(
[size] => 12" x 24"
[size_description] => <p>Rectified</p>
)
[2] => Array
(
[size] => 24" x 24"
[size_description] => <p>Rectified</p>
)
[3] => Array
(
[size] => 24" x 24"
[size_description] => <p>Rectified</p>
)
[4] => Array
(
[size] => 24" x 48"
[size_description] => <p>Rectified</p>
)
[5] => Array
(
[size] => 24" x 48"
[size_description] => <p>Rectified</p>
)
)
I want to get the distinct subarrays based on "size" and I can loop both the size and size_description. I have tried array_unique which is not working right, I am getting only one value that is size. What I tried is
$new_array = array_unique(array_map(function($elem){return $elem['size'];}, $size_array));
I want to get both the values. Is there any way to do this?