php array deletes the same values
In PHP, you can use the "array_unique()" function to remove duplicate values in the array , the usage of this function is "array_unique($array)", its parameter $array represents the array from which duplicate values are to be removed, and the return value of this function is the array after removing duplicate values.
array_unique example
<?php $input = array("a" => "green", "red", "b" => "green", "blue", "red"); $result = array_unique($input); print_r($result); ?>
Output result:
Array ( [a] => green [0] => red [1] => blue )
The above is the detailed content of How to delete identical values from php array. For more information, please follow other related articles on the PHP Chinese website!