You are here: Re: Foreach, If and Variables - Weird variable evaluation « PHP Programming Language « IT news, forums, messages
Re: Foreach, If and Variables - Weird variable evaluation

Posted by Alvaro G Vicario on 06/28/05 11:02

*** Adam wrote/escribió (27 Jun 2005 21:13:04 -0700):
> foreach ($a as $b) {
> if ($b == $value1) {
> statement1;
> }
> if ($b == $value2) {
> statement2;
> }
> }
>
> If I replace $value1 and $value2 with actual values, both if statements
> are tested. However is I leave things as they are using varibles
> containing the values I want to check for only the first if statement
> is tested. It is acting as though it is breaking out of the foreach
> when the first if statement evaluates to true. This does not happen
> with actual values in place of $value1 and $value2 variables.

Your pseudo-code looks correct, so the problem must in the actual code you
don't paste.


--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--

 

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

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