NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help with while loop

Chris Shiflett shiflett at php.net
Mon Nov 27 15:29:53 EST 2006


Randal Rust wrote:
> while(!$unique) {
>     $check=checkDuplicate($newTeam);
>
>     if($check) {
>         $unique=true;
>     } else {
>         $unique=false; }
>     }

Guess what happens when $unique is FALSE?

As a helpful suggestion, when it takes 40 lines of code to check to see
whether a value is in an array, it's probably a good idea to take a step
back and see if there is a simpler solution:

http://php.net/in_array

Hope that helps.

Chris

-- 
Chris Shiflett
http://shiflett.org/



More information about the talk mailing list