print_r($jobtypes) give me an array. Array contains duplicate elements. I want to remove the duplicates. Here is an array
Array
(
[0] => stdClass Object
(
[term_id] => 40
[name] => Babysitting
[slug] => babysitting
[term_group] => 0
[term_taxonomy_id] => 40
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 3
)
[1] => stdClass Object
(
[term_id] => 43
[name] => Lawn Mowing
[slug] => lawn-mowing
[term_group] => 0
[term_taxonomy_id] => 43
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 3
)
[2] => stdClass Object
(
[term_id] => 39
[name] => Leaf Raking
[slug] => leaf-raking
[term_group] => 0
[term_taxonomy_id] => 39
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 2
)
[3] => stdClass Object
(
[term_id] => 41
[name] => Pet Sitting
[slug] => pet-sitting
[term_group] => 0
[term_taxonomy_id] => 41
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 3
)
[4] => stdClass Object
(
[term_id] => 42
[name] => Plant Watering
[slug] => plant-watering
[term_group] => 0
[term_taxonomy_id] => 42
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 2
)
[5] => stdClass Object
(
[term_id] => 44
[name] => Snow Shoveling
[slug] => snow-shoveling
[term_group] => 0
[term_taxonomy_id] => 44
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 5
)
[6] => stdClass Object
(
[term_id] => 40
[name] => Babysitting
[slug] => babysitting
[term_group] => 0
[term_taxonomy_id] => 40
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 3
[filter] => raw
)
)
How to remove the duplicates. I this case
[name] => Babysitting
[slug] => babysitting
[term_group] => 0
[term_taxonomy_id] => 40
[taxonomy] => job_listing_type
[description] =>
[parent] => 0
[count] => 3
[filter] => raw
is twice. I used
$jobtypes= array_map("unserialize", array_unique(array_map("serialize", $jobtypes)));
but not working. thanks