php数组删除指定元素
求教,输出数组格式如下
Array
(
[0] => Array
(
[uname] => 00000000000000000000000006C738A6
[nick] => 0xe5ad99e4b899
[gender] => 0
[face] => 1.jpg )
[1] => Array
(
[uname] => 00000000000000000000000006D2313D
[nick] => 0xe992b1e4b999
[gender] => 0
[face] => 1.jpg )
[2] => Array
(
[uname] => 00000000000000000000000006D37960
[nick] => 0xe591a8e6888a
[gender] => 0
[face] => 1.jpg )
[3] => Array
(
[uname] => 00000000000000000000000006E1D524
[nick] => 0xe8b5b5e794b2
[gender] => 0
[face] => 1.jpg )
[4] => Array
(
[uname] => 00000000000000000000000007859ED7
[nick] => 0xe69d8ee4b881
[gender] => 0
[face] => 1.jpg )
[5] => Array
(
[uname] => 0000000000000000000000000FF68482
[nick] => 0xe4bd95e5b08fe6958f
[gender] => 1
[face] => 1.jpg )
)
这是取好友链信息的一个数组,由于好友里有本人的信息,需要去除,知道本人的uname,nick等信息,请问该如何从这个数组中去除本人的信息。即我想去除 arr[5],但是下标可能会变动,不能用索引来处理。我想去除里面某个数组的信息。在线等,谢谢
------解决方案--------------------
PHP code
foreach($ar as $k => $v) {
if ($v['uname'] == '0000000000000000000000000FF68482' && $v['nick'] == '0xe4bd95e5b08fe6958f') unset($ar[$k]);
}
$ar = array_values($ar);