I have an array like this:
$arr = [
['id' => 12, 'name' => 'Martin', 'cellphone' => '0019949437'],
['id' => 15, 'name' => 'Alex', 'cellphone' => "00183847394"]
];
I need to remove the cellphone
item from array above. I wrote an code to do that like this:
$res = array_filter($arr, function($arr){ unset($arr['cellphone']); return $arr; });
But still that item exists and the $res
is the same as $arr
. What's wrong? What unset doesn't happen?