Many times we need to find duplicate values in an array using php. Using php language this is very easy. For checking the duplicate array value array_unique function is very useful.
There too many array and string functions available in php. PHP itself gives very useful methods for finding the duplicate values from array element.
There are multiple ways to find the duplicate strings. you can use loop and strpos method but using following code snippet, it is very easy to find the duplicate values from an array.
find duplicate values in an array using php
Here I am giving you very simple php example:
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php $array1 = array("banana","apple","pear","banana"); if (count(array_unique($array1)) < count($array1)) echo 'Duplicate entry found in array'; else echo 'No Duplicate values found in array'; ?>
Output: Duplicate entry found in array
Amiable dispatch and this fill someone in on helped me alot in my college assignement. Gratefulness you as your information.