RE: Re: PHP Brain Teasers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
> [snip]
>> <?php
>>
>> function think($i) {
>> 	TRUE == $i ? 'self-aware' : 'cow';
>> 	$return($i);
> 
> $return($i); ?? You sure about that one?
> [/snip]
> 
> *applause* We have a thinker here ladies and gentlemen! OK Stut, for
the
> $10,000 bonus....what should you return here and what is the least
> amount of code you can do it in? 

I'm not sure here, but are you being sarcastic? ;)

Ignoring the extra $ and moving on... I would code it like this...

function think(&$i)
{
     $i = 'am';
}

If I call think, then I am thinking, therefore $i should become 'am'.

If you return 'am' rather than changing $i IMHO you're deviating from 
the spec.
[/snip]

No sarcasm at all. And you are spot on!

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux