Just to throw a spanner (where'd that come from, that wasn't part of the
question) into the works...

What is the state of the light bulb before the test?

If it's on and it's connected to switch #1, then the logic below would
result in "switch #2" being displayed... (maybe.., I don't know how long it
takes for a light bulb to cool down)

Martin

-----Original Message-----
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 27 August 2003 5:35 AM
To: Curt Zirzow; PHP General
Subject: Re: [PHP] PHP Interview questions


From: "Curt Zirzow" <[EMAIL PROTECTED]>

> toggle_light(1);
> sleep(120);
> toggle_light(1);
> 
> toggle_light(2);
> move('self', 'room/');
> 
> if ($lightbulb['temp'] > $room['temp']) {
>   echo "switch #1";
> } elseif ($lightbulb['ison']) {
>   echo "switch #2";
> } else {
>   echo "switch #3";
> }
> 
> hm.. i had to keep it OT somehow :)

Aren't you missing a foreach($lightbulb as $bulb) in there somewhere?

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ Information from NOD32 1.490 (20030820) __________

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to