Re: [PHP] PHP Brain Teasers

2007-07-06 Thread Jochem Maas
tedd wrote: 2b || !2b this is not javascript dude. $_2b | ~$_2b; that said this is one of the coolest so far, nice one tedd. Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers

2007-07-06 Thread Brice
On 7/6/07, tedd [EMAIL PROTECTED] wrote: My favorite. /world End of the world. Great! Brice Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] PHP Brain Teasers

2007-07-06 Thread Daniel Brown
On 7/5/07, tedd [EMAIL PROTECTED] wrote: My favorite. /world Fan-freaking-tastic! I've never seen it before (I live under a rock), but it has so many potential uses. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List

RE: [PHP] PHP Brain Teasers

2007-07-05 Thread Chris Boget
while( TRUE ) { $actions++; $words--; } $bets = array(1,2,3,4,5); unset( $bets ); $arr = array( 'this', 'that', 'times' ); $arr[] = 'behind'; for( $i = 0; $i = 6; $i++ ) { $deep++; } for( $i = 0; $i = 5; $i++ ) { $flies--; } thnx, Chris -- PHP General Mailing List

Re: [PHP] PHP Brain Teasers

2007-07-05 Thread Daniel Brown
On 7/5/07, Chris Boget [EMAIL PROTECTED] wrote: while( TRUE ) { $actions++; $words--; } Actions speak louder than words. $bets = array(1,2,3,4,5); unset( $bets ); All bets are off. $arr = array( 'this', 'that', 'times' ); $arr[] = 'behind'; Behind the times. for( $i = 0; $i =

RE: [PHP] PHP Brain Teasers

2007-07-05 Thread Chris Boget
Actions speak louder than words. Yup. All bets are off. Indeed. Behind the times. Correct. Deep Six. Got it. for( $i = 0; $i = 5; $i++ ) { $flies--; } Time flies backwards? // Not sure on this one. I wasn't sure if this one was done well enough; I guess it wasn't. The

RE: [PHP] PHP Brain Teasers

2007-07-05 Thread tedd
2b || !2b Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP Brain Teasers

2007-07-05 Thread tedd
My favorite. /world Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP Brain Teasers

2007-07-05 Thread tedd
At 9:20 PM +0100 7/5/07, Chris Boget wrote: while( TRUE ) { $actions++; $words--; } $bets = array(1,2,3,4,5); unset( $bets ); $arr = array( 'this', 'that', 'times' ); $arr[] = 'behind'; for( $i = 0; $i = 6; $i++ ) { $deep++; } for( $i = 0; $i = 5; $i++ ) { $flies--; } thnx, Chris

Re: [PHP] PHP Brain Teasers

2007-07-05 Thread heavyccasey
To be.. or not to be? On 7/5/07, tedd [EMAIL PROTECTED] wrote: 2b || !2b Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General

Re: [PHP] PHP Brain Teasers

2007-07-04 Thread tedd
$chickens = 1000; $roost = 0 $home = false; while ($chickens != $roost) { $chickens--; $roost++; } $home = true; Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] PHP Brain Teasers

2007-07-04 Thread Stut
tedd wrote: $chickens = 1000; $roost = 0 $home = false; while ($chickens != $roost) { $chickens--; $roost++; } $home = true; The chickens have come home to roost. class Here { private $chickens; } -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] PHP Brain Teasers

2007-07-04 Thread Robert Cummings
On Wed, 2007-07-04 at 10:18 -0400, tedd wrote: $chickens = 1000; $roost = 0 $home = false; while ($chickens != $roost) { $chickens--; $roost++; } $home = true; When the chickens come home to roost. Cheers, Rob. --

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Richard Lynch
On Tue, June 26, 2007 7:14 pm, Robert Cummings wrote: On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to answer to this one: 'If at first you don't succeed try, try again'. Here's another one... ?php $x = rand( 1, 20 ); for( $i = 0; $i $x; $i++

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 02:17 -0500, Richard Lynch wrote: On Tue, June 26, 2007 7:14 pm, Robert Cummings wrote: On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to answer to this one: 'If at first you don't succeed try, try again'. Here's another one... ?php

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2007-07-03 at 02:17 -0500, Richard Lynch wrote: On Tue, June 26, 2007 7:14 pm, Robert Cummings wrote: On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to answer to this one: 'If at first you don't succeed

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Daniel Brown [EMAIL PROTECTED] wrote: On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2007-07-03 at 02:17 -0500, Richard Lynch wrote: On Tue, June 26, 2007 7:14 pm, Robert Cummings wrote: On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 10:36 -0400, Daniel Brown wrote: A similar one: ? function sing($ignore) { echo It's a song!\n; } (float) $bus; $bus = 14.750; while($wheels = round($bus,2)) { sing($wheels); } ? Well when you say it like that... you trigger my kid

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2007-07-03 at 10:36 -0400, Daniel Brown wrote: A similar one: ? function sing($ignore) { echo It's a song!\n; } (float) $bus; $bus = 14.750; while($wheels = round($bus,2)) { sing($wheels); } ? Well

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] So I'll double-whammy it with a Name That Tune factor: ?php class Thread { var $wheel; function Thread (){ $this-wheel = 'roun\''; } } while($wheel = new Thread()); ? The wheel goes roun and roun [sic] [/snip] if($x == 0.01 || $x ==

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] if($x == 0.01 || $x == 1.0){ $y = in; } One in a thousand ? [/snip] Nope. Yes it is, you just don't know it yet. ;-P -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] So I'll double-whammy it with a Name That Tune factor: ?php class Thread { var $wheel; function Thread (){ $this-wheel = 'roun\''; } } while($wheel = new Thread()); ? The wheel goes

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] if($x == 0.01 || $x == 1.0){ $y = in; } One in a thousand ? [/snip] Nope. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread tedd
Ok, I'll play. Phrase: one = rand(1,100); Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] Ok, I'll play. Phrase: one = rand(1,100); [/snip] One in a million. Still waiting to see if who gets the last one I posted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] if($x == 0.01 || $x == 1.0){ $y = in; } [/snip] Anyone? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Paul Novitski
At 7/3/2007 12:11 PM, Jay Blanchard wrote: [snip] if($x == 0.01 || $x == 1.0){ $y = in; } [/snip] In for a penny, in for a pound. Metric, that is! Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] At 7/3/2007 12:11 PM, Jay Blanchard wrote: [snip] if($x == 0.01 || $x == 1.0){ $y = in; } [/snip] In for a penny, in for a pound. Metric, that is! [/snip] Correct! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Tijnema
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] if($x == 0.01 || $x == 1.0){ $y = in; } [/snip] Anyone? Hint? ;) Tijnema -- Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] In for a penny, in for a pound. Metric, that is! Correct! [/snip] Another...(way easy) $one = six; $other = half-dozen; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: Another...(way easy) Y'think? Heh. $one = six; $other = half-dozen; -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread John
03, 2007 3:13 PM To: Jay Blanchard Cc: Paul Novitski; php-general@lists.php.net Subject: Re: [PHP] PHP Brain Teasers On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: Another...(way easy) Y'think? Heh. $one = six; $other = half-dozen; -- Daniel P. Brown [office] (570

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] if (goose($its)) { $gander = $its; } [/snip] What's good for the goose is good for the gander. [snip] for ($things = 1; $things 0; $things++) { for ($x = 0; $x $things; $x++) { $they = the same; } } [/snip] The more things change the more they stay the

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] if (goose($its)) { $gander = $its; } [/snip] What's good for the goose is good for the gander. [snip] for ($things = 1; $things 0; $things++) { for ($x = 0; $x $things; $x++) { $they = the same; } } [/snip] The

RE: [PHP] PHP Brain Teasers

2007-07-03 Thread Jay Blanchard
[snip] Another...(way easy) Y'think? Heh. $one = six; $other = half-dozen; [/snip] function esquireEliminate($x){ unset($x); } $lawyers = 10; for($i = 0; $i $lawyers; $i++){ eliminateEsquire($i); } Shakespeare has his day in code! -- PHP General Mailing List

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Daniel Brown
On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Another...(way easy) Y'think? Heh. $one = six; $other = half-dozen; [/snip] function esquireEliminate($x){ unset($x); } $lawyers = 10; for($i = 0; $i $lawyers; $i++){ eliminateEsquire($i); } Shakespeare has

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Stut
Daniel Brown wrote: On 7/3/07, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Another...(way easy) Y'think? Heh. $one = six; $other = half-dozen; [/snip] function esquireEliminate($x){ unset($x); } $lawyers = 10; for($i = 0; $i $lawyers; $i++){

Re: [PHP] PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 18:09 -0400, Daniel Brown wrote: The first thing we do, let's kill all the lawyers. Let's wait a few more years, I like my soilent green fresh. Cheers, Rob. -- .. | InterJinn Application Framework -

Re: [PHP] PHP Brain Teasers

2007-06-29 Thread clive
ok this one should be easy: ? $animal = array (pig,cow,bat,chicken,dog); for ($i = 0; $i sizeof($animal); $i++) { $sighted = ($animal[$i] != bat ? see : blind); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers [SPOILER]

2007-06-29 Thread Daniel Brown
On 6/29/07, clive [EMAIL PROTECTED] wrote: ok this one should be easy: ? $animal = array (pig,cow,bat,chicken,dog); for ($i = 0; $i sizeof($animal); $i++) { $sighted = ($animal[$i] != bat ? see : blind); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] PHP Brain Teasers

2007-06-27 Thread Jochem Maas
Daniel Brown wrote: What the hell? Why not start a thread that can be fun and ... here's a easy one: interface Currency {} interface Employee {} class Peanut implements Currency {} class Primate implements Employee {} abstract class HeadHunter { static function match(Currency $c) {

[PHP] PHP Brain Teasers

2007-06-26 Thread Daniel Brown
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 anywhere else yet, but I wouldn't be surprised if it has been. Let's put together some names, phrases, and other stuff expressed as PHP code and see who can come up with a

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Tijnema
On 6/26/07, Daniel Brown [EMAIL PROTECTED] 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 anywhere else yet, but I wouldn't be surprised if it has been. Let's put together some names, phrases, and other stuff

RE: [PHP] PHP Brain Teasers

2007-06-26 Thread Jim Moseby
So here's the first one (it's simple): ? function at($level) { $level == 10 ? $ret = winner : ''; $level == 15 ? $ret = try : ''; $level == 20 ? $ret = first : ''; $level == 25 ? $ret = user : ''; $level == 30 ? $ret = place : '';

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Daniel Brown
On 6/26/07, Tijnema [EMAIL PROTECTED] wrote: On 6/26/07, Daniel Brown [EMAIL PROTECTED] 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 anywhere else yet, but I wouldn't be surprised if it has been. Let's

RE: [PHP] PHP Brain Teasers

2007-06-26 Thread Jim Moseby
Jim, I didn't get any parse errors when I tested it, it just output the stuff. You're right though that is what they say Bah - thwarted (again) by PHP4. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Daniel Brown
On 6/26/07, Jim Moseby [EMAIL PROTECTED] wrote: Jim, I didn't get any parse errors when I tested it, it just output the stuff. You're right though that is what they say Bah - thwarted (again) by PHP4. :( How so? I didn't use any 5th Generation-specific code --

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Jochem Maas
Daniel Brown wrote: On 6/26/07, Jim Moseby [EMAIL PROTECTED] wrote: Jim, I didn't get any parse errors when I tested it, it just output the stuff. You're right though that is what they say Bah - thwarted (again) by PHP4. :( How so? I didn't use any 5th

RE: [PHP] PHP Brain Teasers

2007-06-26 Thread Jim Moseby
On 6/26/07, Jim Moseby [EMAIL PROTECTED] wrote: Jim, I didn't get any parse errors when I tested it, it just output the stuff. You're right though that is what they say Bah - thwarted (again) by PHP4. :( How so? I didn't use any 5th Generation-specific

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Tijnema
On 6/26/07, Jim Moseby [EMAIL PROTECTED] wrote: On 6/26/07, Jim Moseby [EMAIL PROTECTED] wrote: Jim, I didn't get any parse errors when I tested it, it just output the stuff. You're right though that is what they say Bah - thwarted (again) by PHP4. :(

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Eric Newberry
I think I have to answer to this one: 'If at first you don't succeed try, try again'. Eric ? function at($level) { $level == 10 ? $ret = winner : ''; $level == 15 ? $ret = try : ''; $level == 20 ? $ret = first : ''; $level == 25 ? $ret = user : ''; $level

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Robert Cummings
On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to answer to this one: 'If at first you don't succeed try, try again'. Here's another one... ?php $x = rand( 1, 20 ); for( $i = 0; $i $x; $i++ ); while( --$i 0 ); ? Cheers, Rob. --

Re: [PHP] PHP Brain Teasers

2007-06-26 Thread Eric Newberry
- Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Eric Newberry [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 26, 2007 5:14 PM Subject: Re: [PHP] PHP Brain Teasers On Tue, 2007-06-26 at 17:00 -0700, Eric Newberry wrote: I think I have to answer