この方法でフォーマットされたこの配列コレクションがあります。
$collection = array(
'0' => array(
'user_id' => 12345
'name' => 'test'
),
'1' => array(
'user_id' => 6789
'name' => 'test2'
),
)
私の問題は、id:6789 を検索するために for ループを作成したくないということです。
現在、私がやっていることはこれです:
$user_id = 6789
foreach($collection as $key => $collect)
{
if($collect['user_id'] == $user_id)
{
unset($collection[$key]);
}
}
forループを実行する代わりに、データを削除する効率的な方法があるかどうかを尋ねたいだけです。
ありがとう。