<?php $arr = [ '111', '111', '111', '111', '111', '111', '111', '111', '111' ]; print_r($arr); print_r(array_unique($arr)); print_r($arr); //array_unique后,数组本身的值并不会变 ?>
Array ( [0] => 111 [1] => 111 [2] => 111 [3] => 111 [4] => 111 [5] => 111 [6] => 111 [7] => 111 [8] => 111 ) Array ( [0] => 111 ) Array ( [0] => 111 [1] => 111 [2] => 111 [3] => 111 [4] => 111 [5] => 111 [6] => 111 [7] => 111 [8] => 111 )