我有一个像这样的多维数组$membergroups
:
Array ( [0] =>
Array ( [id] => 1645819602
[name] => Oryza NurFa
[first_name] => Oryza
[last_name] => NurFa
[work] => MAN 2 Yogyakarta )
[1] =>
Array ( [id] => 100000251643877
[name] => Lathif Pambudi
[first_name] => Muhammad Lathif
[last_name] => Pambudi
[work] => Omah TI )
[2] =>
Array ( [id] => 1152078197
[name] => Novantio Bangun
[first_name] => Novantio
[last_name] => Bangun
[work] => Pertamina))
如何删除具有特定值的子数组之一。例如,我想删除一个[id] => 100000251643877
里面的数组?所以输出将是:
Array ( [0] =>
Array ( [id] => 1645819602
[name] => Oryza NurFa
[first_name] => Oryza
[last_name] => NurFa
[work] => MAN 2 Yogyakarta )
[1] =>
Array ( [id] => 1152078197
[name] => Novantio Bangun
[first_name] => Novantio
[last_name] => Bangun
[work] => Pertamina))
这是我的php代码,但它不起作用:
if (($key = array_search($user_fbid, $membergroups)) !== false) {
unset($membergroups[$key]);
}
任何帮助将不胜感激。谢谢