Answers for "an associative array save duplicated values under single key"

0

an associative array save duplicated values under single key

$unique = array_reduce($subject, function($final, $article){
    static $seen = array();
    if ( ! array_key_exists($article['fk_article_id'], $seen)) {
        $seen[$article['fk_article_id']] = NULL;
        $final[] = $article;
    }
    return $final;
});
Posted by: Guest on October-24-2020

Code answers related to "an associative array save duplicated values under single key"

Browse Popular Code Answers by Language