$alllist = array(
"link" => $link,
"title" => $title,
"imgurl" => $imgURL,
"price" => $price,
"mname" => $merchantname,
"description" => $description,
);
$all[] = $alllist;
我試圖陣列$all
其中mname
一定值過濾,讓我們說「亞馬遜」。我怎麼做?PHP array_filter
我想這一點,但沒有奏效:
reset($all);
$all_filter = array_filter($all, function(filter) use ($all) {
$key = key($all);
next($all);
return key($all) === 'Amazon';
});
請更新您的問題,更明確的輸入示例,預期輸出和實際輸出。另外,試着更清楚地解釋「你沒有工作」的含義,因爲可能會發生各種不同的方式。 –