Answers for "how to avoid same value in array php"

PHP
1

remove duplicate values in array php

<?php
$list_programming_language = array('C#',  'C++', 'PHP', 'C#', 'PHP');
$result = array_unique($list_programming_language);
print_r($result);
?>
  
// ==> 'C#',  'C++', 'PHP'
Posted by: Guest on March-11-2021
0

how to remove duplicate values from a multidimensional array in php

We used this to de-duplicate results from a variety of overlapping queries.

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

Code answers related to "how to avoid same value in array php"

Browse Popular Code Answers by Language