Find Unique value from array by custome method
<?php
$arr=array(1,1,1,2,1,1,1,1);
$temp="";
$unique="";
$i=1;
foreach($arr as $value){
if($temp!="" && $temp!=$value){
$unique=$value;
break;
}
$temp=$value;
$i++;
}
echo "Unique Value is ".$unique;
?>
Comments
Post a Comment