I have the below code to get an array of values. Some of the entries show duplicate values which I want to get rid of. I want to show only unique values. using array_unique doesn’t seem to work for me.

<?php 
    $archive_data = get_queried_object();
    //echo '<pre>';print_r( $archive_data );
    $archiveId = $archive_data->term_id;
    $categroy_name =  $archive_data->slug;
    $subseminars_found = euromatech_search_subseminars( $archive_data->slug, '', '');
    $array_subseminar = array(); 


    if(!empty($subseminars_found)){
        foreach($subseminars_found as $month){

            foreach($month as $subseminars){
                            foreach($subseminars as $subseminar)
                            {
                            $array_subseminar = $subseminar['venue'];
                            //echo $array_subseminar;



                              //echo esc_html($subseminar['venue']);


    }
    //echo $array_subseminar;
    $unique = array_keys(array_flip($array_subseminar));
    echo $unique;

    }

                            }
                        }
                        ?>

Read more here: Getting Unique values from an array in php


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: