PHP in_array comparing two arrays PHP in_array() 無法比較兩個陣列,這邊採取替代的作法,使用array_intersect(),取得值的交集/* VECTOR COOL https://vector.cool */ $arr1 = array(1,2,3); $arr2 = array(1,2,3,4,5,6,7); $arr = array_intersect($arr1, $arr2); if (count($arr) > 0) { // do something }參考資料:如果文章對您很有幫助請我喝杯咖啡吧 Bitcoin 比特幣錢包: 38ieWXhURt27br9XrDoCeo4eruzKyi8QKs ann71727 Post Views: 887Related posts:[PHP] pathinfo()輕鬆取檔案副檔名、檔案名稱、根目錄相對路徑、資料夾名、PHP 解決 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead inPHP Array 以元素值刪除指定元素PHP include vs require