Great Idea, and I cant wait! On May 17, 2011, at 8:28 PM, Daniel Brown wrote: > Hey, folks; > > To try to boost a bit of creative thinking and increase list > traffic a bit, let's reach back into the past this Friday and bring > back an oldie-but-goodie: > > PHP Brainteasers > > The old-heads on the list may remember how, a few years ago, we > had a rather long group of threads where we would express common > phrases (in English --- sorry to the non-native-speakers) in PHP code. > For those who weren't around or don't recall, here's a very, very > basic example: > > <?php > class proverb { > > var $amount; > > function give() { > return ++$this->amount; > } > > function receive() { > return --$this->amount; > } > > function steal() { > return $this->amount = 0; > } > > function tally() { > return $this->amount; > } > > function proverb($amount) { > $this->amount = $amount; > } > } > > $p = new proverb(5); > > if ($p->give() > $p->receive()) { > echo '\'Tis.'.PHP_EOL; > } else { > echo 'Give me '.$p->amount.'.'.PHP_EOL; > } > ?> > > Here are the details: > > 1.) While it doesn't have to "do" anything necessarily, it > must compile without ANY errors, warnings, or variable notices (other > notices, such as timezone settings, are okay). > 2.) It can be for any version of PHP5 --- legacy code for PHP > < 5.0.0 is not eligible. > 3.) Feel free to use little-known functions, variable > declaration/modification techniques, et cetera. > 4.) Obfuscation does not always count as a brainteaser. > 5.) You may use variable and function names as hints. > 6.) Try to employ at least the basics of code standards and > best practices that should be common sense to all PHP developers. > > The hope is that, with several people participating, newbies and > experts alike will be able to say, "hey, I never thought of doing it > that way!" or, "wow, I didn't even know PHP had that functionality > built-in!" while also achieving the goals mentioned earlier. > > Hope to see a good amount of participation. Remember, wait until > Friday (in your time zone!). If you come up with some in the > meantime, just hold onto them until then; there's no limit to the > amount of submissions anyone can send. In fact, the more we get, the > more fun it should be for those who participate. > > One final note --- whomever starts the thread on Friday, please > use the following subject, verbatim: > > PHP Brainteasers 2011 > > This way, folks who don't want to be involved can't just filter > that thread out and not be bombarded. > > Thanks, all. Looking forward to seeing what everyone invents and > puzzling over them myself! > > -- > </Daniel P. Brown> > Network Infrastructure Manager > http://www.php.net/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php