Page 1 of 1

Does a value exist in an array?

Posted: Fri Oct 15, 2004 12:47 pm
by webcan
Hey guys ...

I have an array, $thistemp, which has values, 1, 3, 5, 6, 12, 15, 19, 22.

I also have a loop which goes through a bunch of numbers, and I want it to check on each number whether that number exists as a value in $thistemp.

I tried this with isset and array_key_exists, but I can't get it to work.

If I do var_dump(isset($thistemp['5'])) for example, it comes back false.

Any ideas?

Thanks,
Peter.

Posted: Fri Oct 15, 2004 12:59 pm
by Weirdan
[php_man]in_array[/php_man]

Posted: Fri Oct 15, 2004 1:06 pm
by webcan
Sweet - thanks!