ACF – Get unique values of array

Is correct to do this way?

`<ul id="filters" class="clearfix">
                <?php
                $taxonomy = 'categoria_sistemas_sanitarios';
                $terms = get_terms( $taxonomy );
                $unique = array();
                echo '<li><span class="filter-'. $title . ' active" data-filter="';
                $li = ' ';
                foreach ( $terms as $term) {
                    $li .= '.' . $term->slug.', ';

                }
                $li = rtrim($li, ', ');
                echo $li;
                echo '">Todos os Sistemas</span></li>';
                while ( $filter_query->have_posts() ) : $filter_query->the_post();

                $categoria = get_the_terms( $post->ID, 'categoria_sistemas_sanitarios' );
                $categoriaSlug = $categoria[0]->slug;
                $categoriaName = $categoria[0]->name;

                if( ! in_array( $categoriaSlug, $unique ) ) :
                    $unique[0] = $categoriaSlug;

                    echo '<li><span class="filter-'. $title . '" data-filter=".' . $unique[0] . '">' . $unique[0] . '</li>';
                endif;
                endwhile; wp_reset_postdata();
                ?>
            </ul>`

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)