I want to know if an array has $arrduplicate elements.
$arr
array_unique() must work:
array_unique()
if (count(array_unique($arr)) == count($arr)) echo "Array does not contain duplicate elements"; else echo "Array contains duplicate elements";
Check array_unique .
I am not sure if there is a built-in function for this. But you could do
if (count($arr) == count(array_unique($arr)) { //array has no unique elements }
Source: https://habr.com/ru/post/1751521/More articles:ΡΠ°Π·Π½ΠΈΡΠ° ΠΌΠ΅ΠΆΠ΄Ρ ΡΡΠ°ΡΠΈΡΠ΅ΡΠΊΠΈΠΌΠΈ ΠΈ Π½ΠΎΡΠΌΠ°Π»ΡΠ½ΡΠΌΠΈ java-Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ Π² ΡΠ°ΠΉΠ»Π΅ android make - androidClustering on tomcat using spring - springShortcut for testing PHP code - pythonIn a Tomcat cluster, how to share beans in an application? - javaHow to crop html text and maintain format in PHP - phpThe maximum length of the elements Div and Span - htmlDjango Admin - mapping fields for intermediate fields for M2M models - pythonLog4net does not register in Release mode - log4nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1751525/undefined-references-to-functions-with-c-template-methods&usg=ALkJrhhR6xEc2NtKGGBuuiGFlT6b5dcZ1wΠΠ°ΠΊ ΠΈΠΌΠΏΠΎΡΡΠΈΡΠΎΠ²Π°ΡΡ ΠΎΠ±ΡΠ΅ΠΊΡΡ ΠΈ ΠΈΡ Π·Π°Π²ΠΈΡΠΈΠΌΡΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΡ ΡΠ΅ΡΠ΅Π· excel - javaAll Articles