Answers for "get unique item from array php"

PHP
1

array_unique

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

Array
(
    [a] => green
    [0] => red
    [1] => blue
)
Posted by: Guest on May-26-2020
0

unique key value array php

$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
Posted by: Guest on February-15-2021

Code answers related to "get unique item from array php"

Browse Popular Code Answers by Language