"green", "blue", "red");$result = array_unique($input);print_r($result">
时间:2021-07-01 10:21:17 帮助过:6人阅读
<?php $input = array("a" => "green", "red", "b" => "green", "blue", "red"); $result = array_unique($input); print_r($result); ?>输出结果: Array ( [a] => green [0] => red [1] => blue ) 例2. array_unique() 和类型 <?php $input = array(4, "4", "3", 4, 3, "3"); $result = array_unique($input); var_dump($result); ?> 输出结果: array(2) { [0] => int(4) [2] => string(1) "3" } |