unique array

110

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

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

// app.php

$data = [19, 21, 19, 21, 46, 21, 29, 21, 18];
print_r(array_unique($data));

Comments

Submit
0 Comments