Re: Re: PHP Brain Teasers
| From: | Stut | Date: | Wed, 27 Jun 2007 09:22:18 +0000 |
| Subject: | Re: Re: PHP Brain Teasers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257836@lists.php.net to get a copy of this message | ||
David Restall - System Administrator wrote:
Hi,Wow, what a comment. Mine has that comment too, it's just not noise, it's tabs. Where in "Once bitten twice shy" does it say "and if you continue it repeats" ?? -Stut -- http://stut.net/Colin Guthrie wrote:Probably a more accurate solution would be :- function x()Daniel Brown wrote:Surely this should be... function x() {What the hell? Why not start a thread that can be fun and challenging for all of us. It's something I haven't seen doneHere's another quickie: Dead simple one! <?php function x($x) { switch ($x) {case 1: return 'bitten'; case 2: return 'shy';} }static $count = 0; $count++; switch ($count) { case 1: return 'bitten'; case 2: return 'shy'; } return '';} -Stut{ static $count = 0; $count++; switch ($count % 3) { case 0: case 2: return 'shy';case 1: return 'bitten'; } } // xAnd it's commented :-P