|
Posted by dysfunct on 10/31/07 02:25
I have some code in which there are a bunch of objects. The objects
are in arrays. When checking one of the arrays for a number thats in
a variable in an object, I cant seem to get the search to work.
However I can get the search to work by putting in one instance of
that variable. But then comparing the two shows they're both the same.
I don't get how if they're both the same one works and one doesn't.
This is from inside one of the foreach statements:
[code]
if (in_array($val->onumber,$ponum))
echo "FOUND VARIABLE";
if (in_array(358737,$ponum))
echo "FOUND THE LITERAL";
if ($val->onumber == 358737)
echo "WHYWHYWHY";
[/code]
The output is FOUND THE LITERALWHYWHYWHY. Why will it find the value
directly but not the variable, when it admits they're the same?
BTW, the in_array is just what I was using to check this. What I
really want to do is an array_search, that was doing the same thing.
Any suggestions?
Navigation:
[Reply to this message]
|