Saturday, 15 May 2010

arrays - PHP loop and IF condition -



arrays - PHP loop and IF condition -

hi have 2 arrays , want check them if have element equal (same) each other , if have should on page if not print no.

i have made code not know why doesn't work.

p.s. elements of arrays contain text.

$res = count($title1); ($j = 0; $j <= $res; $j++) { if(strtoupper($title2[$j]) == strtoupper($title1[$j])) { echo 'yes<br/>'; echo $title2[$j].'==='.$title1[$j].'<br/'; } else{ echo 'no<br/>'; } }

foreach ($array1 $value) { if(in_array($value , $array2) { echo 'yes<br/>'; echo $value; $count = $count + 1 ; } }

this right reply :) thnx @hamidreza

php arrays loops if-statement

No comments:

Post a Comment