php - Removing duplicated values from two-dimensional array -
i want remove duplicated values two-dimensional array.
i have used array_unique
function two-dimensional array. , seems function not work two-dimensional array.
any suggestion or appreciated.
thank in advance.
here array output below:
array ( [0] => array ( [is_hide] => 0 [key] => lho0vtlsfci7wwq2ewqy1nup5u13pxwlxt8s0775 ) [1] => array ( [is_hide] => 0 [key] => gisklozxrhxtmhklaeempuwojms08ftweencmrpk ) [2] => array ( [is_hide] => 0 [key] => lho0vtlsfci7wwq2ewqy1nup5u13pxwlxt8s0775 ) )
you can use php's array_map()
function:
$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
see this example.
Comments
Post a Comment