How to compare array values in php? -


i need compare array values each other.these values unique ids. so, have check whether id values repeated.

<?php  $id=array("firstid2012","secondid2014","thirddid2010","fourthid2014");  $idcount=count($id);  for($i=0;$i<$idcount;$i++){  //how compare??   }    ?> 

if repeated id true, have change value of array value.so need know array value repeated also.

if (count($idvalues) == count(array_unique($idvalues))){   //all values distincts } else {   //there duplicated values   $duplicated=array();   $visited=array();   foreach($idvalues $value){       if (in_array($value,$visited)){          $duplicated[]=$value;       }       $visited[]=$value;   }   $duplicated=array_uniq($duplicated); } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -