RE: [PHP] Re: PHP Brain Teasers

From: Date: Wed, 27 Jun 2007 14:52:21 +0000
Subject: RE: [PHP] Re: PHP Brain Teasers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-257871@lists.php.net to get a copy of this message
[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!

« previous php.general (#257871) next »