Answers for "select an item from array using a unique value 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
1

check duplicate data in array php

$counts = array_count_values($array);
            $duplicate_title  = array_filter($array, function ($value) use ($counts) {
                return $counts[$value] > 1;
            });
Posted by: Guest on October-06-2020

Code answers related to "select an item from array using a unique value php"

Browse Popular Code Answers by Language