Page 1 of 1

How to see if any values in array equal any values in anthr?

Posted: Thu Apr 24, 2003 8:18 pm
by 3dron
How do I check all the values in one array against all the values in another array?


If any values in
$row_Comments['id'] == any values in $row_Posts['id']



I could figure it out with a while statement, but a little confusing for me. And I'm sure there is a simple way.

RR

Posted: Thu Apr 24, 2003 8:41 pm
by patrikG

Posted: Thu Apr 24, 2003 8:57 pm
by 3dron
I gues I'm stupid.

$row_Comments['id']
$row_Posts['id']

are reported as string with var_dump

How can I compare all their values?

another function

Posted: Fri Apr 25, 2003 3:10 pm
by phpScott
while looping through one array you can compare that value to the other using
http://www.php.net/manual/en/function.in-array.php

phpScott