On Wed, 2007-06-27 at 00:24 +0100, Colin Guthrie wrote: > Daniel Brown wrote: > > 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 done > > Here's another quickie: Dead simple one! > > <?php > > function x($x) > { > switch ($x) > { > case 1: return 'bitten'; > case 2: return 'shy'; > } > } Hmmm... would be better as (: <?php function x( $x ) { echo 'bitten'; echo 'shy'; echo 'shy'; } ?> Here's another one: <?php class money { var $pennies = 0; function money( $amount=0 ) { $this->pennies = $amount; } function save() { return true; } } class account { var $total = 0; function account( $init=0 ) { $this->total = $init; } function add( $money ) { $this->total += $money->pennies; } } $earned = new account(); $penny = new money( 1 ); if( $penny->save() ) { $earned->add( $penny ); } ?> Cheers, Rob -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php