prprissyqx
New Member
I am trying to find duplicated values/string in an array using \[code\]for\[/code\] loop\[code\] <?php $b=array('a','b','c','a','b'); $c=count($b); $d=array(); for($i=0;$i<=($c-1);$i++) { for($j=1;$j<=($c-1);$j++) { if($b[$i]!=$b[$j]) { $flag=1; } } if($flag==1) { $d[$i]=$b[$i]; } } print_R($d); ?>\[/code\]where is my mistake? I have used array $d to display non duplicate values.....NOTE: I need to try this only with \[code\]for\[/code\] loop - I know how to do it using array functions.