How to remove duplicate values from an array in PHP

后端 未结 24 1395
故里飘歌
故里飘歌 2020-11-22 03:40

How can I remove duplicate values from an array in PHP?

24条回答
  •  囚心锁ツ
    2020-11-22 04:00

    $array = array("a" => "moon", "star", "b" => "moon", "star", "sky");
    
    // Deleting the duplicate items
    $result = array_unique($array);
    print_r($result);
    

    ref : Demo

提交回复
热议问题