array_unique()
functionYou can use the PHP array_unique()
function to remove the duplicate elements or values form an array. If the array contains the string keys, then this function will keep the first key encountered for every value, and ignore all the subsequent keys. Here's an example:
<?php
$array = array("a" => "moon", "star", "b" => "moon", "star", "sky");
// Deleting the duplicate items
$result = array_unique($array);
print_r($result);
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on harsukh21@gmail.com
How to remove white spaces from a string in jQuery
Use the jQuery $.trim() function You...Show Image Preview Before Upload In jQuery Bootstrap Example
Today, Laravelcode share one helpfull tu...Laravel 5.5 - simple crud operation with example
Today, we are sharing how to make s...How to check if an element exists in jQuery
Use the jQuery .length Property You c...How to run Python 3 Script in Laravel 7?
Hi, Artisan In this article i will sh...