You are here: Re: Frustrated and confused « PHP Programming Language « IT news, forums, messages
Re: Frustrated and confused

Posted by Juliette on 10/31/07 03:09

dysfunct wrote:
> 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?
>


Can you try this and tell me what you get ?

if ($val->onumber === 358737)
echo "SEE, THEY ARE REALLY THE SAME";

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация