How to remove duplicates of one-dimensional array, delete zero zero null and reset index by php
Xiaobian to share with you how php to achieve a one-dimensional array to weight, delete 0,null, index reset, I hope you have something to gain after reading this article, let's discuss it together!
One-dimensional array de-duplication, delete 0,null, index reset
$array = array (0,1,0,2,null,1,3,4,null,0);$array = array_values (array_unique(array_diff($array, [0, null]))); //remove 0,null; remove var_export($array); /* output: array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4,)*/After reading this article, I believe you have a certain understanding of "how to achieve one-dimensional array de-duplication, delete 0,null, index reset". If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!