PHP : create unique array using array_map
array(
array( "Title", 50, 96 ),
array( "Other Title", 110, 225 ),
array( "Title", 110, 225 ),
array( "Title", 110, 225 ),
)
From this array we can show only unique array elements using following function.
$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
Output
array( array( "Title" => array( 50, 96 ), array(110, 225) ) array( "Other Title", array( 110, 225 ) ) )
No comments:
Post a Comment