Answers for "remove duplicate value from array laravel"

PHP
18

php remove duplicates from array

<?php
$fruits_list = array('Orange',  'Apple', ' Banana', 'Cherry', ' Banana');
$result = array_unique($fruits_list);
print_r($result);
?>
  
Output:

Array ( [0] => Orange [1] => Apple [2] => Banana [3] => Cherry )
Posted by: Guest on March-04-2020
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

laravel remove duplicates from array

$array = array(1, 2, 2, 3);
$array = array_unique($array); // Array is now (1, 2, 3)
Posted by: Guest on December-23-2020

Code answers related to "remove duplicate value from array laravel"

Browse Popular Code Answers by Language