NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help!!

jose sanchez j_r_sanchez at yahoo.com
Wed May 29 16:22:54 EDT 2002


> > Some how the print statement in the checkId()
> never
> > gets executed. I don't know why. What am I doing
> > wrong?
> 
> Hmm... did you mean to have the the 'return true'
> within
> the if test?  Basically, it's only doing one
> iteration of
> the for loop and returning true.  Something like:
> 
> function checkId( $id )
> {
>   global $text;
> 
>    for($i=1; $i<5; $i++ )
>    {
>      if( $text[$i]==$id ) {     // missing brace
>        print( 'Compared...' );
>        return true;
>      }                          // missing brace
>    }
>    return false;
> }
> 
> This is the main reason I ALWAYS use {...} for
> if()'s, etc.
> even if there is only one statement ;).
> 
> Don't know if this is what's causing your problem
> but it's
> something that seemed contrary to intent.  Hope,
> this helps.
> 
In my original code the {} were in place. This is not
causing the problem..

=====
"An ounce of gold cannot buy an ounce of time."
- Anonymous


www.whmicro.com

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the talk mailing list