开发者

unset the array

开发者 https://www.devze.com 2022-12-23 07:09 出处:网络
I have two arrays. I\'d like to merge them into one, but remove the redundant values. How can I d开发者_JAVA百科o this?Use array_unique function .

I have two arrays. I'd like to merge them into one, but remove the redundant values. How can I d开发者_JAVA百科o this?


Use array_unique function .

Example

<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>

Output:

Array
(
    [a] => green
    [0] => red
    [1] => blue
)
0

精彩评论

暂无评论...
验证码 换一张
取 消