Home >Backend Development >PHP Tutorial >How to remove value keys from one-dimensional array and two-dimensional array in PHP
This article mainly shares with you the method of removing the value key of one-dimensional and two-dimensional arrays in PHP. It mainly explains it to you in the form of code. I hope it can help you.
Two-dimensional array removes duplicate value keys
private function array_unique_fb($origin){ foreach ($origin as $key => $v){ $v = json_encode($v); $temp[$key] = $v; } $temp = array_unique($temp); foreach ($temp as $k => $val){ $temp[$k] =json_decode($val,true); } return $temp; }
One-dimensional array can be directly array_unique
The above is the detailed content of How to remove value keys from one-dimensional array and two-dimensional array in PHP. For more information, please follow other related articles on the PHP Chinese website!