Re: [PHP] Re: PHP Brain Teasers

2008-01-04 Thread Daniel Brown
On Jul 20, 2007 1:09 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 This isn't necessarily a brain-teaser, but it's still pretty cool.
  Dice (the employment site) has a new advertisement out there that
 says the following:

 
 What's missing from your job?

 ?php
 format = 'The %2s contains %1d orders';
 printf(format, num, location);
 ?
 

 I thought it was a pretty simple form of genius, so to speak.

They're bck!

This was something that came to mind when discussing loop
detection in language processing.

?
function wheel($test) {
if($test == 1) {
return 1;
} else {
$insanity = Same result.;
wheel(0);
}
}

wheel(0);
?

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-20 Thread Daniel Brown

   This isn't necessarily a brain-teaser, but it's still pretty cool.
Dice (the employment site) has a new advertisement out there that
says the following:


What's missing from your job?

?php
format = 'The %2s contains %1d orders';
printf(format, num, location
?


   I thought it was a pretty simple for of genius, so to speak.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-20 Thread tedd

At 2:09 PM -0400 7/20/07, Daniel Brown wrote:

   This isn't necessarily a brain-teaser, but it's still pretty cool.


In similar fashion, I tell clients, you can have:

a) Quality;
b) Cheap;
c) Quick;

Pick any two.

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] Re: PHP Brain Teasers

2007-07-13 Thread Richard Lynch
On Thu, July 12, 2007 10:20 am, Daniel Brown wrote:
 On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
 G... must be nice, some of us had to toil 18 hours a day
 sweeping
 chimneys!

 ;)

 Cheers,
 Rob.

 What do you mean us?  Weren't you born before they invented the
 chimney?

?php
  $when = array('uphill', 'in', 'the', 'snow');
  $age = time() - mktime(0, 0, 0, 0, 0, mt_rand(10, 50);
?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-13 Thread Richard Lynch
On Thu, July 12, 2007 10:26 am, Robert Cummings wrote:
 On Thu, 2007-07-12 at 11:20 -0400, Daniel Brown wrote:
 On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
  G... must be nice, some of us had to toil 18 hours a day
 sweeping
  chimneys!
 
  ;)
 
  Cheers,
  Rob.

 What do you mean us?  Weren't you born before they invented
 the chimney?

 I wasn't born silly-ass, I was hatched. :)

So the egg definitely came before the chicken!

:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-13 Thread Robert Cummings
On Fri, 2007-07-13 at 01:59 -0500, Richard Lynch wrote:
 On Thu, July 12, 2007 10:20 am, Daniel Brown wrote:
  On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
  G... must be nice, some of us had to toil 18 hours a day
  sweeping
  chimneys!
 
  ;)
 
  Cheers,
  Rob.
 
  What do you mean us?  Weren't you born before they invented the
  chimney?
 
 ?php
   $when = array('uphill', 'in', 'the', 'snow');
   $age = time() - mktime(0, 0, 0, 0, 0, mt_rand(10, 50);

It's missing a bracket after mt_rand( :)

But more importantly there's an omission of the concept of both
ways ;)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-13 Thread Daniel Brown

On 7/13/07, Robert Cummings [EMAIL PROTECTED] wrote:

But more importantly there's an omission of the concept of both
ways ;)


   Ha!  I was thinking exactly the same thing!

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Jay Blanchard
[snip]
Mine was trying to go for an old funk song that starts:

What goes up, must come down.
Spinning wheel got to go 'round
Drop all the painted ponies by the riverside.
[mumble] let the spinning wheel slide.

Only later did I realize I broke the cardinal rule of Name That Tune
and have NO IDEA what the song title is nor who wrote/sang it...
[/snip]

Spinning Wheel - Blood, Sweat  Tears

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
Mine was trying to go for an old funk song that starts:

What goes up, must come down.
Spinning wheel got to go 'round
Drop all the painted ponies by the riverside.
[mumble] let the spinning wheel slide.

Only later did I realize I broke the cardinal rule of Name That Tune
and have NO IDEA what the song title is nor who wrote/sang it...
[/snip]

Spinning Wheel - Blood, Sweat  Tears

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




?
$evil[] = 6;
$evil[] = 6;
$evil[] = 6;
for($i=0;$icount($evil);$i++) {
   $_ = sqrt($evil);
}
?

   That also illustrates to newbies the allowance of using an
underscore as a variable.  (Thank God it's almost Friday)

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Thijs Lensselink
On Thu, 12 Jul 2007 09:56:18 -0400, Daniel Brown [EMAIL PROTECTED] wrote:
 On 7/12/07, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 Mine was trying to go for an old funk song that starts:

 What goes up, must come down.
 Spinning wheel got to go 'round
 Drop all the painted ponies by the riverside.
 [mumble] let the spinning wheel slide.

 Only later did I realize I broke the cardinal rule of Name That Tune
 and have NO IDEA what the song title is nor who wrote/sang it...
 [/snip]

 Spinning Wheel - Blood, Sweat  Tears

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 
 ?
 $evil[] = 6;
 $evil[] = 6;
 $evil[] = 6;
 for($i=0;$icount($evil);$i++) {
 $_ = sqrt($evil);
 }
 ?
 
 That also illustrates to newbies the allowance of using an
 underscore as a variable.  (Thank God it's almost Friday)
 
 --
 Daniel P. Brown
 [office] (570-) 587-7080 Ext. 272
 [mobile] (570-) 766-8107
 

number of the beast? :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Colin Guthrie [EMAIL PROTECTED] wrote:

Thijs Lensselink wrote:
 ?
 $evil[] = 6;
 $evil[] = 6;
 $evil[] = 6;
 for($i=0;$icount($evil);$i++) {
 $_ = sqrt($evil);
 }
 ?


   It was supposed to be money is the root of all evil, but the
code above wouldn't work correctly anyway, as each time through the
for() loop it'll try to get the square root of the array.


Thank _God_ it's Friday??? Covering all bases are we? ;)


   No, I said, thank God it's ALMOST Friday.  Nothing to do with
the puzzle, I'm just exhausted this week for some reason.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Tijnema

On 7/12/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 7/12/07, Colin Guthrie [EMAIL PROTECTED] wrote:
 Thijs Lensselink wrote:
  ?
  $evil[] = 6;
  $evil[] = 6;
  $evil[] = 6;
  for($i=0;$icount($evil);$i++) {
  $_ = sqrt($evil);
  }
  ?

   It was supposed to be money is the root of all evil, but the
code above wouldn't work correctly anyway, as each time through the
for() loop it'll try to get the square root of the array.

 Thank _God_ it's Friday??? Covering all bases are we? ;)

   No, I said, thank God it's ALMOST Friday.  Nothing to do with
the puzzle, I'm just exhausted this week for some reason.

--
Daniel P. Brown


You can probably remember the good old time of being a child and
having holiday ;)

Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:

G... must be nice, some of us had to toil 18 hours a day sweeping
chimneys!

;)

Cheers,
Rob.


   What do you mean us?  Weren't you born before they invented the chimney?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Jay Blanchard
[snip]
  ?
  $evil[] = 6;
  $evil[] = 6;
  $evil[] = 6;
  for($i=0;$icount($evil);$i++) {
  $_ = sqrt($evil);
  }
  ?

It was supposed to be money is the root of all evil, but the
code above wouldn't work correctly anyway, as each time through the
for() loop it'll try to get the square root of the array.
[/snip]

The actual quote is the love of money is the root of all evil, so you
need to find the root of love.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Robert Cummings
On Thu, 2007-07-12 at 11:20 -0400, Daniel Brown wrote:
 On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
  G... must be nice, some of us had to toil 18 hours a day sweeping
  chimneys!
 
  ;)
 
  Cheers,
  Rob.
 
 What do you mean us?  Weren't you born before they invented the chimney?

I wasn't born silly-ass, I was hatched. :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Thu, 2007-07-12 at 11:20 -0400, Daniel Brown wrote:
 On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
  G... must be nice, some of us had to toil 18 hours a day sweeping
  chimneys!
 
  ;)
 
  Cheers,
  Rob.

 What do you mean us?  Weren't you born before they invented the chimney?

I wasn't born silly-ass, I was hatched. :)

Cheers,
Rob.
--
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...



   Did you come before or after the chicken egg?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Robert Cummings
On Thu, 2007-07-12 at 11:27 -0400, Daniel Brown wrote:
 On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Thu, 2007-07-12 at 11:20 -0400, Daniel Brown wrote:
   On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:
G... must be nice, some of us had to toil 18 hours a day sweeping
chimneys!
   
;)
   
Cheers,
Rob.
  
   What do you mean us?  Weren't you born before they invented the 
   chimney?
 
  I wasn't born silly-ass, I was hatched. :)

 Did you come before or after the chicken egg?

After the first one, but I fried it up and so earth had to wait another
couple of million years for a chicken to evolve again.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Stut

Robert Cummings wrote:

On Thu, 2007-07-12 at 11:20 -0400, Daniel Brown wrote:

On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:

G... must be nice, some of us had to toil 18 hours a day sweeping
chimneys!

;)

Cheers,
Rob.

What do you mean us?  Weren't you born before they invented the chimney?


I wasn't born silly-ass, I was hatched. :)


As in I've hatched a Cummings plan ??

;)

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Tijnema [EMAIL PROTECTED] wrote:

You can probably remember the good old time of being a child and
having holiday ;)

Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info



   Don't rub it in, Matijn ;-P

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Tijnema

On 7/12/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 7/12/07, Tijnema [EMAIL PROTECTED] wrote:
 You can probably remember the good old time of being a child and
 having holiday ;)

 Tijnema
 --
 Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info


   Don't rub it in, Tijnema ;-P

--
Daniel P. Brown


Hehe ;)

*fixed your post * :P

Tijnema

--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Tijnema [EMAIL PROTECTED] wrote:

On 7/12/07, Daniel Brown [EMAIL PROTECTED] wrote:
 On 7/12/07, Tijnema [EMAIL PROTECTED] wrote:
  You can probably remember the good old time of being a child and
  having holiday ;)
 
  Tijnema
  --
  Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info
 

Don't rub it in, Tijnema ;-P

 --
 Daniel P. Brown

Hehe ;)

*fixed your post * :P

Tijnema

--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info



   Ha!

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Robert Cummings
On Thu, 2007-07-12 at 17:06 +0200, Tijnema wrote:
 On 7/12/07, Daniel Brown [EMAIL PROTECTED] wrote:
  On 7/12/07, Colin Guthrie [EMAIL PROTECTED] wrote:
   Thijs Lensselink wrote:
?
$evil[] = 6;
$evil[] = 6;
$evil[] = 6;
for($i=0;$icount($evil);$i++) {
$_ = sqrt($evil);
}
?
 
 It was supposed to be money is the root of all evil, but the
  code above wouldn't work correctly anyway, as each time through the
  for() loop it'll try to get the square root of the array.
 
   Thank _God_ it's Friday??? Covering all bases are we? ;)
 
 No, I said, thank God it's ALMOST Friday.  Nothing to do with
  the puzzle, I'm just exhausted this week for some reason.
 
  --
  Daniel P. Brown
 
 You can probably remember the good old time of being a child and
 having holiday ;)

G... must be nice, some of us had to toil 18 hours a day sweeping
chimneys!

;)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Jon Anderson

Daniel Brown wrote:

   Did you come before or after the chicken egg?


Relevant to the above:

$a = array('Chicken','Egg');
echo The  . $a[array_rand($a)] .  comes first.;

I appologize if this one's already been done...I've only glanced at a 
few entries in this thread, entertaining though it is. :-)


jon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Daniel Brown

On 7/12/07, Robert Cummings [EMAIL PROTECTED] wrote:

  I wasn't born silly-ass, I was hatched. :)

 Did you come before or after the chicken egg?

After the first one, but I fried it up and so earth had to wait another
couple of million years for a chicken to evolve again.


  Ah, so then, presumably, the first chicken egg was a relative of
yours doesn't that make you the Second Cummings?

  Who knew we were in the presence of holiness?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Tijnema

On 7/12/07, Jon Anderson [EMAIL PROTECTED] wrote:

Daniel Brown wrote:
Did you come before or after the chicken egg?

Relevant to the above:

$a = array('Chicken','Egg');
echo The  . $a[array_rand($a)] .  comes first.;

I appologize if this one's already been done...I've only glanced at a
few entries in this thread, entertaining though it is. :-)

jon



The same fault is made over and over again ;) as the fish egg was
earlier (as noted here)
Your code should be this:
$a = array('Chicken','Chicken egg');
echo The  . $a[array_rand($a)] .  comes first.;

Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-11 Thread Richard Lynch
On Tue, July 3, 2007 3:51 pm, Jochem Maas wrote:
 $I = null; sleep(10); $I = rear(); function rear() {};

Looks like a snooze alarm to me... :-)

Mine was trying to go for an old funk song that starts:

What goes up, must come down.
Spinning wheel got to go 'round
Drop all the painted ponies by the riverside.
[mumble] let the spinning wheel slide.

Only later did I realize I broke the cardinal rule of Name That Tune
and have NO IDEA what the song title is nor who wrote/sang it...

And Google and lyrics search are not helping much so far...

Sorry!!!

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-07 Thread Tijnema

On 7/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Isn't this a PHP list? Why is there discussion about chickens?

if ($this == PHP List) {
 unset('chicken discussion!');
}


Hmm, I'm too bad with this things :(

For me, the chicken never predated the chicken egg, and the chicken
egg never predated the chicken :)

Tijnema


On 7/6/07, Robert Cummings [EMAIL PROTECTED] wrote:
 On Fri, 2007-07-06 at 21:40 -0400, tedd wrote:
  At 10:24 AM -0400 7/6/07, Robert Cummings wrote:
  On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
 I doubt that one can demarcate the non-chicken parents from the
chicken offspring. So... it is perplexing.
  
  We don't need to demarcate, we only need to know that it happened.
 
  Yes, but knowing that something has happened, does not mean that we
  know how it happened.  :-)

 Actually in this case there is only one possible way it could have
 happened. I'll lay it out simply for you if I must, but it's simple
 logical progression.

  This, my friend, is one of those things we can debate forever without
  reaching a definitive answer.

 No, it absolutely has a definitive answer.

  Thus, my assertion that this question is perplexing still stands.
  Unless, of course, you wish to challenge it and thus confirm my
  assertion further.  Check and mate.  :-)

 The basis of your assertion is incorrect. Methinks you're being
 presumptuous by declaring check and mate prematurely.

 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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-07 Thread tedd

At 8:26 PM -0700 7/6/07, [EMAIL PROTECTED] wrote:

Isn't this a PHP list? Why is there discussion about chickens?

if ($this == PHP List) {
unset('chicken discussion!');
}



Because obviously, we occasionally wander off topic.

Your php example made your point very well and was within the subject 
-- nicely done.


But, you should had given us time to guess without providing an 
explanation. Sometimes, less is more.


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] Re: PHP Brain Teasers

2007-07-06 Thread Jochem Maas
Daniel Brown wrote:
Let's get obscure try to guess it before running the code.  It
 actually shouldn't be difficult.

I tried to figure it out - I couldn't, I ran the code and I still don't
get it. oh well :-)

 
 ?
 
 class Brainteaser {
function
 paint($original_image,$rgb_string1,$rgb_string2,$input1,$input2) {
header(Content-type: image/png);
$im = imagecreatefromjpeg($original_image);
$rgb1 = explode(',',$rgb_string1);
$rgb2 = explode(',',$rgb_string2);
$color1 = imagecolorallocate($im,$rgb1[0],$rgb1[1],$rgb1[2]);
$color2 = imagecolorallocate($im,$rgb2[0],$rgb2[1],$rgb2[2]);
$px = (imagesx($im) - 7.5 * strlen($input1)) / 2;
imagestring($im, 50, $px, 90, $input2, $color1);
imagestring($im, 50, ($px + 30), 120, $input1, $color2);
imagepng($im);
imagedestroy($im);
}
 }
 
 $objects = new Brainteaser();
 
 $objects-original_image =
 http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg;;
 
 $_SCRIPT[word] = task;
 $_SCRIPT[otherword] = ticket;
 
 $update_word1 = $_SCRIPT[word].et;
 
 $rgb1 = 134,89,32;
 $rgb2 = 231,223,48;
 
 $objects-paint($objects-original_image,$rgb1,$rgb2,$update_word1,str_replace(c,s,$_SCRIPT[otherword]));
 
 ?
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Kaleb Pomeroy
A ticket, a tasket, a red and yellow basket

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 06, 2007 2:59 AM
To: Daniel Brown
Cc: Larry Garfield; php-general@lists.php.net
Subject: Re: [PHP] Re: PHP Brain Teasers

Daniel Brown wrote:
Let's get obscure try to guess it before running the code.  It
 actually shouldn't be difficult.

I tried to figure it out - I couldn't, I ran the code and I still don't
get it. oh well :-)

 
 ?
 
 class Brainteaser {
function
 paint($original_image,$rgb_string1,$rgb_string2,$input1,$input2) {
header(Content-type: image/png);
$im = imagecreatefromjpeg($original_image);
$rgb1 = explode(',',$rgb_string1);
$rgb2 = explode(',',$rgb_string2);
$color1 = imagecolorallocate($im,$rgb1[0],$rgb1[1],$rgb1[2]);
$color2 = imagecolorallocate($im,$rgb2[0],$rgb2[1],$rgb2[2]);
$px = (imagesx($im) - 7.5 * strlen($input1)) / 2;
imagestring($im, 50, $px, 90, $input2, $color1);
imagestring($im, 50, ($px + 30), 120, $input1, $color2);
imagepng($im);
imagedestroy($im);
}
 }
 
 $objects = new Brainteaser();
 
 $objects-original_image =
 http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg;;
 
 $_SCRIPT[word] = task;
 $_SCRIPT[otherword] = ticket;
 
 $update_word1 = $_SCRIPT[word].et;
 
 $rgb1 = 134,89,32;
 $rgb2 = 231,223,48;
 

$objects-paint($objects-original_image,$rgb1,$rgb2,$update_word1,str_r
eplace(c,s,$_SCRIPT[otherword]));
 
 ?
 

-- 
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



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread tedd

At 11:00 PM -0400 7/5/07, Robert Cummings wrote:

On Thu, 2007-07-05 at 22:44 -0400, tedd wrote:

 At 4:48 PM -0400 7/5/07, Daniel Brown wrote:
 On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
   Which came first, the chicken or the egg?
 
 The egg, fish were laying them long before chickens walked the earth :)

  
 
  But actually, it was dinosaurs.

Um... fish predate all land creatures according to evolution
that's not to say something with eggs didn't predate fish, but I'm too
lazy to go look.



Yes, but I was talking about predecessors to the chicken, like 
Archeopteryx (one of the first feathered dinosaurs), which is/was (my 
education is dated) believed to be the predecessor of birds.


As far as eggs are concerned, they predate fish considerably.

So, IF the question is Which came first, the chicken or the egg? -- 
then the answer is clearly the egg.


However, if the question is Which came first, the chicken or the 
chicken's egg? -- then the answer is much less obvious.


Evolution is alteration in the genetic code usually caused by changes 
in the critter's environment. So, the question becomes, is the 
alteration of the genetic code found in the egg a random fluctuation 
of genetic code not found in the parent, or is it the product of a 
lifetime experience, under the influence of the parent's environment, 
that changed the parents genetic code in reproduction?


Also, there is a difference in the genetic code you have and the code 
your pass on in terms of dominance/preference with your spouse's 
genetic code. In other words, male and female produce something 
different than either of them. However, for both to reach 
reproduction age, they both had to have successful genetic makeup. 
As such, their offspring has a different chance, perhaps better, of 
reaching reproduction age and passing on it's contribution.


Now at what point does the offspring differ enough in genetic code to 
be classified as a chicken? That's an interesting question 
considering that it's offspring may not be a chicken (consider that). 
Pre-chickens will have to go through numerous generations before 
producing a true chicken in our taxonomy.


I doubt that one can demarcate the non-chicken parents from the 
chicken offspring. So... it is perplexing.


Cheers,

tedd

===



But dwelling on the topic, the chicken egg problem is actually stated
incorrectly to some degree, it's a more interesting question to ask:

What came first? The chicken or the chicken egg?

Now this question is only perplexing until you realize that the concept
of chicken egg is ambiguous. Is a chicken egg an egg that was
created by a chicken, or an egg from which a chicken hatches? As such,
there are two possible answers to the age old question...

Case 1: a chicken egg is defined by having been created
by a chicken.

In this case the chicken must have come first :)

Case 2: a chicken egg is defined by being an egg from
which a chicken hatches.

In this case the egg comes first since the first
genetic chicken was born from an egg created by
it's direct ancestor that was not a chicken.

See... it's not perplexing at all :)

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.  |
`'



--
---
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] Re: PHP Brain Teasers

2007-07-06 Thread Paul Novitski

At 7/5/2007 01:45 PM, Daniel Brown wrote:

$objects-original_image =
http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg;;

$_SCRIPT[word] = task;
$_SCRIPT[otherword] = ticket;

$update_word1 = $_SCRIPT[word].et;

$rgb1 = 134,89,32;
$rgb2 = 231,223,48;

$objects-paint($objects-original_image,$rgb1,$rgb2,$update_word1,str_replace(c,s,$_SCRIPT[otherword]));



Without bothering to run the code I'd say a tisket, a tasket, a green 
and yellow basket.  Now what obscure corner of childhood poetry 
memories did that come from?  It's easy to google...  My god, Ella 
Fitzgerald?  THE Ella Fitzgerald??  Yowsa!


Bemusedly,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Tijnema

On 7/6/07, tedd [EMAIL PROTECTED] wrote:

At 11:00 PM -0400 7/5/07, Robert Cummings wrote:
On Thu, 2007-07-05 at 22:44 -0400, tedd wrote:
  At 4:48 PM -0400 7/5/07, Daniel Brown wrote:
  On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
Which came first, the chicken or the egg?
  
  The egg, fish were laying them long before chickens walked the earth :)
   
  
   But actually, it was dinosaurs.

Um... fish predate all land creatures according to evolution
that's not to say something with eggs didn't predate fish, but I'm too
lazy to go look.


Yes, but I was talking about predecessors to the chicken, like
Archeopteryx (one of the first feathered dinosaurs), which is/was (my
education is dated) believed to be the predecessor of birds.

As far as eggs are concerned, they predate fish considerably.

So, IF the question is Which came first, the chicken or the egg? --
then the answer is clearly the egg.

However, if the question is Which came first, the chicken or the
chicken's egg? -- then the answer is much less obvious.

Evolution is alteration in the genetic code usually caused by changes
in the critter's environment. So, the question becomes, is the
alteration of the genetic code found in the egg a random fluctuation
of genetic code not found in the parent, or is it the product of a
lifetime experience, under the influence of the parent's environment,
that changed the parents genetic code in reproduction?

Also, there is a difference in the genetic code you have and the code
your pass on in terms of dominance/preference with your spouse's
genetic code. In other words, male and female produce something
different than either of them. However, for both to reach
reproduction age, they both had to have successful genetic makeup.
As such, their offspring has a different chance, perhaps better, of
reaching reproduction age and passing on it's contribution.

Now at what point does the offspring differ enough in genetic code to
be classified as a chicken? That's an interesting question
considering that it's offspring may not be a chicken (consider that).
Pre-chickens will have to go through numerous generations before
producing a true chicken in our taxonomy.

I doubt that one can demarcate the non-chicken parents from the
chicken offspring. So... it is perplexing.

Cheers,

tedd





From which point in the evolution do you call it a chicken egg? See it

like bytes,  is a fish egg, and  is a chicken egg,
then it went from fish egg to chicken egg like this:
0001
0011
0111

0001
0011
0111


So, at which point do you call it which egg, same with the fish and
the chicken itself. If you call the fish earlier a chicken than you
call the fish egg a chicken egg, then the chicken was first, if you
call the fish egg earlier a chicken egg than you call the fish a
chicken, then the chicken egg was first...

Tijnema



But dwelling on the topic, the chicken egg problem is actually stated
incorrectly to some degree, it's a more interesting question to ask:

 What came first? The chicken or the chicken egg?

Now this question is only perplexing until you realize that the concept
of chicken egg is ambiguous. Is a chicken egg an egg that was
created by a chicken, or an egg from which a chicken hatches? As such,
there are two possible answers to the age old question...

 Case 1: a chicken egg is defined by having been created
 by a chicken.

 In this case the chicken must have come first :)

 Case 2: a chicken egg is defined by being an egg from
 which a chicken hatches.

 In this case the egg comes first since the first
 genetic chicken was born from an egg created by
 it's direct ancestor that was not a chicken.

See... it's not perplexing at all :)

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.  |
`'


--
---
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





--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Daniel Brown

On 7/6/07, Paul Novitski [EMAIL PROTECTED] wrote:

Without bothering to run the code I'd say a tisket, a tasket, a green
and yellow basket.


   Very close.  The RGB values actually give away the colors (brown
and yellow), and through string replacement and appending, the words
`task` and `ticket` become `tasket` and `tisket`, respectively.  Then
their order is reversed when printed on the picture.  In honor of the
British bastards like Robert Cummings ( :-P ) I used a British version
of the old nursery rhyme, which starts, A tisket, a tasket, a brown
and yellow basket.


Now what obscure corner of childhood poetry
memories did that come from?  It's easy to google...  My god, Ella
Fitzgerald?  THE Ella Fitzgerald??  Yowsa!


   Ha!  Actually, Google is where I got it from, too.  I wanted to do
something a bit more involved, and as soon as I saw the first two
lines of that nursery rhyme, I already had the vision in mind.
However, I may be just a *bit* disturbed by your attraction to Ella
Fitzgerald especially in her present state.  Though if you've ever
read her biography damn, what a tough lady!



Bemusedly,

Paul


   Glad you enjoyed it.  If I may say so myself, I thought it was
rather well done.  I really enjoyed it, too so far, it was the
most involved --- and actually worked when ran.

   /me takes a bow.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Robert Cummings
On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
 At 11:00 PM -0400 7/5/07, Robert Cummings wrote:
 On Thu, 2007-07-05 at 22:44 -0400, tedd wrote:
   At 4:48 PM -0400 7/5/07, Daniel Brown wrote:
   On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:
   On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
 Which came first, the chicken or the egg?
   
   The egg, fish were laying them long before chickens walked the earth :)

   
But actually, it was dinosaurs.
 
 Um... fish predate all land creatures according to evolution
 that's not to say something with eggs didn't predate fish, but I'm too
 lazy to go look.
 
 
 Yes, but I was talking about predecessors to the chicken, like 
 Archeopteryx (one of the first feathered dinosaurs), which is/was (my 
 education is dated) believed to be the predecessor of birds.
 
 As far as eggs are concerned, they predate fish considerably.
 
 So, IF the question is Which came first, the chicken or the egg? -- 
 then the answer is clearly the egg.
 
 However, if the question is Which came first, the chicken or the 
 chicken's egg? -- then the answer is much less obvious.
 
 Evolution is alteration in the genetic code usually caused by changes 
 in the critter's environment. So, the question becomes, is the 
 alteration of the genetic code found in the egg a random fluctuation 
 of genetic code not found in the parent, or is it the product of a 
 lifetime experience, under the influence of the parent's environment, 
 that changed the parents genetic code in reproduction?
 
 Also, there is a difference in the genetic code you have and the code 
 your pass on in terms of dominance/preference with your spouse's 
 genetic code. In other words, male and female produce something 
 different than either of them. However, for both to reach 
 reproduction age, they both had to have successful genetic makeup. 
 As such, their offspring has a different chance, perhaps better, of 
 reaching reproduction age and passing on it's contribution.
 
 Now at what point does the offspring differ enough in genetic code to 
 be classified as a chicken? That's an interesting question 
 considering that it's offspring may not be a chicken (consider that). 
 Pre-chickens will have to go through numerous generations before 
 producing a true chicken in our taxonomy.

I described below how one knows which came first and for which side of
the ambiguity you choose to define chicken egg. You're above analysis
of determining chickens from non-chickens is fabricated confusion in
your own mind. We don't need to know the time at which a bird became a
chicken, nor do we need to know it's genetic makeup. It's not important
to the greater question, all that is important is to know that at some
point, no matter when that point was or what birds were involved, there
was an instance when a hatched bird was a chicken that had two parents
that were not chickens. At that exact event when the offspring was a
chicken and the parents were not we know that the chicken was finally
born. And that event had to happen unless you believe in Creationism or
Intelligent Design.

 I doubt that one can demarcate the non-chicken parents from the 
 chicken offspring. So... it is perplexing.

We don't need to demarcate, we only need to know that it happened.

 
 But dwelling on the topic, the chicken egg problem is actually stated
 incorrectly to some degree, it's a more interesting question to ask:
 
  What came first? The chicken or the chicken egg?
 
 Now this question is only perplexing until you realize that the concept
 of chicken egg is ambiguous. Is a chicken egg an egg that was
 created by a chicken, or an egg from which a chicken hatches? As such,
 there are two possible answers to the age old question...
 
  Case 1: a chicken egg is defined by having been created
  by a chicken.
 
  In this case the chicken must have come first :)
 
  Case 2: a chicken egg is defined by being an egg from
  which a chicken hatches.
 
  In this case the egg comes first since the first
  genetic chicken was born from an egg created by
  it's direct ancestor that was not a chicken.
 
 See... it's not perplexing at all :)
 

-- 
..
| 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



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread tedd

At 10:24 AM -0400 7/6/07, Robert Cummings wrote:

On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
  I doubt that one can demarcate the non-chicken parents from the

 chicken offspring. So... it is perplexing.


We don't need to demarcate, we only need to know that it happened.


Yes, but knowing that something has happened, does not mean that we 
know how it happened.  :-)


This, my friend, is one of those things we can debate forever without 
reaching a definitive answer.


Thus, my assertion that this question is perplexing still stands. 
Unless, of course, you wish to challenge it and thus confirm my 
assertion further.  Check and mate.  :-)


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] Re: PHP Brain Teasers

2007-07-06 Thread tedd

At 4:16 PM +0200 7/6/07, Tijnema wrote:

From which point in the evolution do you call it a chicken egg? See it
like bytes,  is a fish egg, and  is a chicken egg,
then it went from fish egg to chicken egg like this:
0001
0011
0111

0001
0011
0111


So, at which point do you call it which egg, same with the fish and
the chicken itself. If you call the fish earlier a chicken than you
call the fish egg a chicken egg, then the chicken was first, if you
call the fish egg earlier a chicken egg than you call the fish a
chicken, then the chicken egg was first...



Tijnema:

For good grief -- you're going to hurt yourself thinking that way.

The world is not made of one's and zero's but rather thresholds, 
chaotic systems, and a bunch of weird stuff we haven't figured out 
yet.


We observe phenomena, we develop algorithms and use them until they 
don't fit observations anymore and then we develop others to take 
their place. And all the while we believe that we have figured 
something out, that we know what the answer is -- but the truth of 
the matter is we're like children putting our tinker toys together to 
mimic the things around us. From our perspective, we're pretty good 
at it. But, I wonder what the perspective will be one thousand years 
from now? Do you think todays answers will serve tomorrow's questions?


You know, I was a lot smarter when I was younger and knew better.

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] Re: PHP Brain Teasers

2007-07-06 Thread Tijnema

On 7/7/07, tedd [EMAIL PROTECTED] wrote:

At 4:16 PM +0200 7/6/07, Tijnema wrote:
From which point in the evolution do you call it a chicken egg? See it
like bytes,  is a fish egg, and  is a chicken egg,
then it went from fish egg to chicken egg like this:
0001
0011
0111

0001
0011
0111


So, at which point do you call it which egg, same with the fish and
the chicken itself. If you call the fish earlier a chicken than you
call the fish egg a chicken egg, then the chicken was first, if you
call the fish egg earlier a chicken egg than you call the fish a
chicken, then the chicken egg was first...


Tijnema:

For good grief -- you're going to hurt yourself thinking that way.

The world is not made of one's and zero's but rather thresholds,
chaotic systems, and a bunch of weird stuff we haven't figured out
yet.


Thank god for that ;) All that computers with ones and zeros is enough :P
But, you CAN compare it with ones and zeros :)



We observe phenomena, we develop algorithms and use them until they
don't fit observations anymore and then we develop others to take
their place. And all the while we believe that we have figured
something out, that we know what the answer is -- but the truth of
the matter is we're like children putting our tinker toys together to
mimic the things around us. From our perspective, we're pretty good
at it. But, I wonder what the perspective will be one thousand years
from now? Do you think todays answers will serve tomorrow's questions?


Not tomorrow's questions ;) next year maybe...



You know, I was a lot smarter when I was younger and knew better.

Cheers,

tedd


They all say that ;)


Tijnema

ps. This was a late night reply, ... Or I should say early morning ;)
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread Robert Cummings
On Fri, 2007-07-06 at 21:40 -0400, tedd wrote:
 At 10:24 AM -0400 7/6/07, Robert Cummings wrote:
 On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
I doubt that one can demarcate the non-chicken parents from the
   chicken offspring. So... it is perplexing.
 
 We don't need to demarcate, we only need to know that it happened.
 
 Yes, but knowing that something has happened, does not mean that we 
 know how it happened.  :-)

Actually in this case there is only one possible way it could have
happened. I'll lay it out simply for you if I must, but it's simple
logical progression.

 This, my friend, is one of those things we can debate forever without 
 reaching a definitive answer.

No, it absolutely has a definitive answer.

 Thus, my assertion that this question is perplexing still stands. 
 Unless, of course, you wish to challenge it and thus confirm my 
 assertion further.  Check and mate.  :-)

The basis of your assertion is incorrect. Methinks you're being
presumptuous by declaring check and mate prematurely.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-06 Thread heavyccasey

Isn't this a PHP list? Why is there discussion about chickens?

if ($this == PHP List) {
unset('chicken discussion!');
}

On 7/6/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Fri, 2007-07-06 at 21:40 -0400, tedd wrote:
 At 10:24 AM -0400 7/6/07, Robert Cummings wrote:
 On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
I doubt that one can demarcate the non-chicken parents from the
   chicken offspring. So... it is perplexing.
 
 We don't need to demarcate, we only need to know that it happened.

 Yes, but knowing that something has happened, does not mean that we
 know how it happened.  :-)

Actually in this case there is only one possible way it could have
happened. I'll lay it out simply for you if I must, but it's simple
logical progression.

 This, my friend, is one of those things we can debate forever without
 reaching a definitive answer.

No, it absolutely has a definitive answer.

 Thus, my assertion that this question is perplexing still stands.
 Unless, of course, you wish to challenge it and thus confirm my
 assertion further.  Check and mate.  :-)

The basis of your assertion is incorrect. Methinks you're being
presumptuous by declaring check and mate prematurely.

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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Robert Cummings
On Thu, 2007-07-05 at 10:19 -0400, Daniel Brown wrote:
 An easy one going on a previous theme.  And see?  Every so often,
 I come up with some good ideas like this thread albeit more
 intrusive than productive :-\
 
 ?
 
 global $eggs;
 global $chickens;
 
 function hatch($eggs) {
 return 1;
 }
 
 if(!hatch($eggs)) {
 echo Null;
 } else {
 count($chickens);
 }
 ?

Don't count your chickens till they hatch.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Daniel Brown

On 7/4/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Wed, 2007-07-04 at 19:38 +0100, Colin Guthrie wrote:
 Robert Cummings wrote:
  For every action there is an equal and opposite reaction. Thanks Abe,

 Sir Abraham Newton - father of modern mechanics!

It's the new physics where you have to lobby to get things to move :/

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




   An easy one going on a previous theme.  And see?  Every so often,
I come up with some good ideas like this thread albeit more
intrusive than productive :-\

?

global $eggs;
global $chickens;

function hatch($eggs) {
   return 1;
}

if(!hatch($eggs)) {
   echo Null;
} else {
   count($chickens);
}
?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread tedd



 $which = isset($_GET['chicken']) ? $_GET['egg'] : null;

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] Re: PHP Brain Teasers

2007-07-05 Thread Kaleb Pomeroy
Which came first, the chicken or the egg?

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 05, 2007 2:56 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: PHP Brain Teasers



  $which = isset($_GET['chicken']) ? $_GET['egg'] : null;

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 Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Daniel Brown

On 7/5/07, tedd [EMAIL PROTECTED] wrote:



  $which = isset($_GET['chicken']) ? $_GET['egg'] : null;

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




   That's the question that still perplexes even the greatest of minds.


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Robert Cummings
On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
 Which came first, the chicken or the egg?

The egg, fish were laying them long before chickens walked the earth :)

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Daniel Brown

   Let's get obscure try to guess it before running the code.  It
actually shouldn't be difficult.

?

class Brainteaser {
   function paint($original_image,$rgb_string1,$rgb_string2,$input1,$input2) {
   header(Content-type: image/png);
   $im = imagecreatefromjpeg($original_image);
   $rgb1 = explode(',',$rgb_string1);
   $rgb2 = explode(',',$rgb_string2);
   $color1 = imagecolorallocate($im,$rgb1[0],$rgb1[1],$rgb1[2]);
   $color2 = imagecolorallocate($im,$rgb2[0],$rgb2[1],$rgb2[2]);
   $px = (imagesx($im) - 7.5 * strlen($input1)) / 2;
   imagestring($im, 50, $px, 90, $input2, $color1);
   imagestring($im, 50, ($px + 30), 120, $input1, $color2);
   imagepng($im);
   imagedestroy($im);
   }
}

$objects = new Brainteaser();

$objects-original_image =
http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg;;

$_SCRIPT[word] = task;
$_SCRIPT[otherword] = ticket;

$update_word1 = $_SCRIPT[word].et;

$rgb1 = 134,89,32;
$rgb2 = 231,223,48;

$objects-paint($objects-original_image,$rgb1,$rgb2,$update_word1,str_replace(c,s,$_SCRIPT[otherword]));
?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Daniel Brown

On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
 Which came first, the chicken or the egg?

The egg, fish were laying them long before chickens walked the earth :)


   Yeah, good point, smartass.  ;-P

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread Robert Cummings
On Thu, 2007-07-05 at 16:08 -0400, Daniel Brown wrote:

 That's the question that still perplexes even the greatest of minds.

I've never found it very perplexing :|

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread tedd

At 4:17 PM -0400 7/5/07, Robert Cummings wrote:

On Thu, 2007-07-05 at 16:08 -0400, Daniel Brown wrote:


 That's the question that still perplexes even the greatest of minds.


I've never found it very perplexing :|

Cheers,
Rob.



Yeah, but he did say the greatest of minds.  :-)

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] Re: PHP Brain Teasers

2007-07-05 Thread Robert Cummings
On Thu, 2007-07-05 at 22:37 -0400, tedd wrote:
 At 4:17 PM -0400 7/5/07, Robert Cummings wrote:
 On Thu, 2007-07-05 at 16:08 -0400, Daniel Brown wrote:
 
   That's the question that still perplexes even the greatest of minds.
 
 I've never found it very perplexing :|
 
 Cheers,
 Rob.
 
 
 Yeah, but he did say the greatest of minds.  :-)

I know *sniffle*.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-05 Thread tedd

At 4:48 PM -0400 7/5/07, Daniel Brown wrote:

On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:

 Which came first, the chicken or the egg?


The egg, fish were laying them long before chickens walked the earth :)


   Yeah, good point, smartass.  ;-P


Yeah, fish got all the action back then.

But actually, it was dinosaurs.

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] Re: PHP Brain Teasers

2007-07-05 Thread Robert Cummings
On Thu, 2007-07-05 at 22:44 -0400, tedd wrote:
 At 4:48 PM -0400 7/5/07, Daniel Brown wrote:
 On 7/5/07, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2007-07-05 at 15:04 -0500, Kaleb Pomeroy wrote:
   Which came first, the chicken or the egg?
 
 The egg, fish were laying them long before chickens walked the earth :)
 
 Yeah, good point, smartass.  ;-P
 
 Yeah, fish got all the action back then.
 
 But actually, it was dinosaurs.

Um... fish predate all land creatures according to evolution
that's not to say something with eggs didn't predate fish, but I'm too
lazy to go look.

But dwelling on the topic, the chicken egg problem is actually stated
incorrectly to some degree, it's a more interesting question to ask:

What came first? The chicken or the chicken egg?

Now this question is only perplexing until you realize that the concept
of chicken egg is ambiguous. Is a chicken egg an egg that was
created by a chicken, or an egg from which a chicken hatches? As such,
there are two possible answers to the age old question...

Case 1: a chicken egg is defined by having been created
by a chicken.

In this case the chicken must have come first :)

Case 2: a chicken egg is defined by being an egg from
which a chicken hatches.

In this case the egg comes first since the first
genetic chicken was born from an egg created by
it's direct ancestor that was not a chicken.

See... it's not perplexing at all :)

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



Re: [PHP] Re: PHP Brain Teasers (SPOILER)

2007-07-04 Thread Jochem Maas
Colin Guthrie wrote:
 Jochem Maas wrote:
 Jochem Maas wrote:
 three for the price of one, cheap at half the price ...

 for ($me = 1; $you = $me; $me++);
 
 One for me and one for you?

correct!

 Everything that is mine is yours?
 To me, to you?
 
 
 $u = create_function(\$bond, if (\$bond  2) echo \live\; else die();)
 $u();$u();$u();
 this one here should have been:

 $u = create_function(\$bond, if (\$bond  3) echo \live\; else die();)
 $u(1);$u(2);$u(3);
 
 I started thinking it was Live and Let Die but then I realised I had
 the wrong movie and it's actually You only live Twice. WHich is good
 cos Connery was a far better bond than Moore!

eggzactly ;-)

 
 $I = null; sleep(10); $I = rear(); function rear() {};
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread tedd

Try this:

-(4 * 20 + 7)

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] Re: PHP Brain Teasers

2007-07-04 Thread Jochem Maas
this one should be easy:

function work($v) { echo $v,; }
foreach(array_merge(range(9,12),range(1,5)) as $ing)
work($ing);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Zoltán Németh
2007. 07. 4, szerda keltezéssel 16.20-kor Colin Guthrie ezt írta:
 Jochem Maas wrote:
  this one should be easy:
  
  function work($v) { echo $v,; }
  foreach(array_merge(range(9,12),range(1,5)) as $ing)
  work($ing);
  
 
 
 dollyWorkin' 9 til' 5/dolly
 
 
 On a similar theme:
 
 function jack($all)
 {
   static int $play = 0;
   if ($all == 'work'  !$play)
 return 'dull boy!';
   $play++;
 }
 

all work and no play makes jack a dull boy

greets
Zoltán Németh

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Stut

Colin Guthrie wrote:

Stut wrote:

class Here
{
private $chickens;
}

-Stut


What you do in your private live with chickens is a mystery to us all
Stut..

:p


Nobody 'ere but us chickens.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Larry Garfield
On Wednesday 04 July 2007, tedd wrote:
 Try this:

 -(4 * 20 + 7)

 tedd

Four score and seven years ago...  Thanks Abe. :-)


Try this one:

foreach ($actions as $action) {
  $actions[] = -$action;
}

This is fun. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Robert Cummings
On Wed, 2007-07-04 at 12:31 -0500, Larry Garfield wrote:
 On Wednesday 04 July 2007, tedd wrote:
  Try this:
 
  -(4 * 20 + 7)
 
  tedd
 
 Four score and seven years ago...  Thanks Abe. :-)
 
 
 Try this one:
 
 foreach ($actions as $action) {
   $actions[] = -$action;
 }
 
 This is fun. :-)

For every action there is an equal and opposite reaction. Thanks Abe,
though I would have preferred For every action by me there is a very
minimal and opposite reaction that makes the task really really easy.

:)

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Robert Cummings
On Wed, 2007-07-04 at 14:26 -0400, Robert Cummings wrote:
 On Wed, 2007-07-04 at 12:31 -0500, Larry Garfield wrote:
  On Wednesday 04 July 2007, tedd wrote:
   Try this:
  
   -(4 * 20 + 7)
  
   tedd
  
  Four score and seven years ago...  Thanks Abe. :-)
  
  
  Try this one:
  
  foreach ($actions as $action) {
$actions[] = -$action;
  }
  
  This is fun. :-)
 
 For every action there is an equal and opposite reaction.

  Thanks Abe,

Bleh, fingers not doing as their told... should have been Thanks
Newton :)

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-04 Thread Robert Cummings
On Wed, 2007-07-04 at 19:38 +0100, Colin Guthrie wrote:
 Robert Cummings wrote:
  For every action there is an equal and opposite reaction. Thanks Abe,
 
 Sir Abraham Newton - father of modern mechanics!

It's the new physics where you have to lobby to get things to move :/

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Daniel Brown

On 7/3/07, Colin Guthrie [EMAIL PROTECTED] wrote:

Robert Cummings 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
 try,
 try again'.
 Here's another one...

 ?php

 $x = rand( 1, 20 );
 for( $i = 0; $i  $x; $i++ );
 while( --$i  0 );

 ?
 Didn't see an answer to this one...

 It was pretty simple... What goes up must come down. :)

Damn, I was so close!!

Ahh well, how about this:

?php

abstract class wood
{
  protected function the()
  {

  }
}

class thetrees extends wood
{
  public function foo()
  {
  }
}


$u = new thetrees();
$u-wood(); // Blerg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




   If a tree falls in the woods, and no one is there to hear it,
does it make a sound?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 19:54 +0100, Colin Guthrie wrote:
 Robert Cummings 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
  try,
  try again'.
  Here's another one...
 
  ?php
 
  $x = rand( 1, 20 );
  for( $i = 0; $i  $x; $i++ );
  while( --$i  0 );
 
  ?
  Didn't see an answer to this one...
  
  It was pretty simple... What goes up must come down. :)
 
 Damn, I was so close!!
 
 Ahh well, how about this:
 
 ?php
 
 abstract class wood
 {
   protected function the()
   {
 
   }
 }
 
 class thetrees extends wood
 {
   public function foo()
   {
   }
 }
 
 
 $u = new thetrees();
 $u-wood(); // Blerg

Is it related to humping trees and getting wood?

Unfortunately I don't have a better comment since I don't see any
woodchuck references :)

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 20:00 +0100, Colin Guthrie wrote:
 Daniel Brown wrote:
  Ahh well, how about this:
 
  ?php
 
  abstract class wood
  {
protected function the()
{
 
}
  }
 
  class thetrees extends wood
  {
public function foo()
{
}
  }
 
 
  $u = new thetrees();
  $u-wood(); // Blerg
 
 If a tree falls in the woods, and no one is there to hear it,
  does it make a sound?
  
 
 
 Nope - It's more about not seeing what is in front of you. The parse
 error is deliberate

Your hint was too good :)

Can't see the woods for the trees.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
 Jay Blanchard wrote:
  [snip]
  if($x == 0.01 || $x == 1.0){
 $y = in;
  }
  [/snip]
  
  Anyone?
 
 
 I'm struggling.

I'm not getting any lightbulbs either :/

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Daniel Brown

On 7/3/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 7/3/07, Colin Guthrie [EMAIL PROTECTED] wrote:
 Jay Blanchard wrote:
  [snip]
  if($x == 0.01 || $x == 1.0){
 $y = in;
  }
  [/snip]
 
  Anyone?


 I'm struggling.

 Col

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



   The best I could come up with was one in a hundred.

   I think I'm stumpifimicated, too.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 15:26 -0400, Robert Cummings wrote:
 On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
  Jay Blanchard wrote:
   [snip]
   if($x == 0.01 || $x == 1.0){
  $y = in;
   }
   [/snip]
   
   Anyone?
  
  
  I'm struggling.
 
 I'm not getting any lightbulbs either :/

Best I can think currently is In dollars and cents.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Tijnema

On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Tue, 2007-07-03 at 15:26 -0400, Robert Cummings wrote:
 On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
  Jay Blanchard wrote:
   [snip]
   if($x == 0.01 || $x == 1.0){
  $y = in;
   }
   [/snip]
  
   Anyone?
 
 
  I'm struggling.

 I'm not getting any lightbulbs either :/

Best I can think currently is In dollars and cents.

Cheers,
Rob.


I would write that as In cents or dollars.

Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Daniel Brown

On 7/3/07, Colin Guthrie [EMAIL PROTECTED] wrote:

Jay Blanchard wrote:
 [snip]
 if($x == 0.01 || $x == 1.0){
$y = in;
 }
 [/snip]

 Anyone?


I'm struggling.

Col

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Jim Lucas

Colin Guthrie wrote:

Robert Cummings 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
try,
try again'.

Here's another one...

?php

$x = rand( 1, 20 );
for( $i = 0; $i  $x; $i++ );
while( --$i  0 );

?

Didn't see an answer to this one...

It was pretty simple... What goes up must come down. :)


Damn, I was so close!!

Ahh well, how about this:

?php

abstract class wood
{
  protected function the()
  {

  }
}

class thetrees extends wood
{
  public function foo()
  {
  }
}


$u = new thetrees();
$u-wood(); // Blerg



Maybe..

Protect our public forests

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 21:41 +0200, Tijnema wrote:
 On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Tue, 2007-07-03 at 15:26 -0400, Robert Cummings wrote:
   On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
Jay Blanchard wrote:
 [snip]
 if($x == 0.01 || $x == 1.0){
$y = in;
 }
 [/snip]

 Anyone?
   
   
I'm struggling.
  
   I'm not getting any lightbulbs either :/
 
  Best I can think currently is In dollars and cents.
 
  Cheers,
  Rob.
 
 I would write that as In cents or dollars.

The union formed by the or operator creates a set that includes both. As
such when describing the set one would use and.

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Tijnema

On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Tue, 2007-07-03 at 21:41 +0200, Tijnema wrote:
 On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Tue, 2007-07-03 at 15:26 -0400, Robert Cummings wrote:
   On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
Jay Blanchard wrote:
 [snip]
 if($x == 0.01 || $x == 1.0){
$y = in;
 }
 [/snip]

 Anyone?
   
   
I'm struggling.
  
   I'm not getting any lightbulbs either :/
 
  Best I can think currently is In dollars and cents.
 
  Cheers,
  Rob.

 I would write that as In cents or dollars.

The union formed by the or operator creates a set that includes both. As
such when describing the set one would use and.

Cheers,
Rob.
--


Aah, nvm, it was wrong anyway ;)

Tijnema

--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 21:54 +0200, Tijnema wrote:
 On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Tue, 2007-07-03 at 21:41 +0200, Tijnema wrote:
   On 7/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
On Tue, 2007-07-03 at 15:26 -0400, Robert Cummings wrote:
 On Tue, 2007-07-03 at 20:18 +0100, Colin Guthrie wrote:
  Jay Blanchard wrote:
   [snip]
   if($x == 0.01 || $x == 1.0){
  $y = in;
   }
   [/snip]
  
   Anyone?
 
 
  I'm struggling.

 I'm not getting any lightbulbs either :/
   
Best I can think currently is In dollars and cents.
   
Cheers,
Rob.
  
   I would write that as In cents or dollars.
 
  The union formed by the or operator creates a set that includes both. As
  such when describing the set one would use and.
 
  Cheers,
  Rob.
  --
 
 Aah, nvm, it was wrong anyway ;)

Yeah, I knew Paul had it when I saw his repsonse *hehe*. I was thinking
in dollars and cents instead of sterling :)

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 21:26 +0100, David Restall - System Administrator
wrote:
 Hi,
 
 there are two in this one :-
 
 function Cat($Danger = )
   {
   static int $Lives = 9;
 
   if (preg_match(/^curiosity$/i, $Danger))
   die(Cat Killed);
 
   $Threats = array(dog, flu, fall, drowning);
 
   if (in_array(strtolower($Danger), $Threats))
   $Lives --;
 
   if ($Lives == 0)
   die(No More Chances);
   }   // Cat
 
 TTFN

Curiosity killed the cat.
and 
Cats have 9 lives?

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Jochem Maas
three for the price of one, cheap at half the price ...

for ($me = 1; $you = $me; $me++);



$u = create_function(\$bond, if (\$bond  2) echo \live\; else die();)
$u();$u();$u();



$I = null; sleep(10); $I = rear(); function rear() {};

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-07-03 Thread Jochem Maas
Jochem Maas wrote:
 three for the price of one, cheap at half the price ...
 
 for ($me = 1; $you = $me; $me++);
 
 
 
 $u = create_function(\$bond, if (\$bond  2) echo \live\; else die();)
 $u();$u();$u();

this one here should have been:

$u = create_function(\$bond, if (\$bond  3) echo \live\; else die();)
$u(1);$u(2);$u(3);

 
 
 
 $I = null; sleep(10); $I = rear(); function rear() {};
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread clive

?php
class money
{


LOL, a penny saved is a penny earned


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

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';
  }
}



Surely this should be...

function x()
{
static $count = 0;
$count++;
switch ($count)
{
case 1: return 'bitten';
case 2: return 'shy';
}
return '';
}

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

David Restall - System Administrator wrote:

Hi,


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';
  }
}


Surely this should be...

function x()
{
 static $count = 0;
 $count++;
 switch ($count)
 {
 case 1: return 'bitten';
 case 2: return 'shy';
 }
 return '';
}

-Stut


Probably a more accurate solution would be :-

function x()
 {
 static $count = 0;
 $count++;
 switch ($count % 3)
 {
 case 0:
 case 2: return 'shy';

 case 1: return 'bitten';
 }
 }  // x

And it's commented :-P


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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers (SPOILER + new one)

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 09:26 +0100, Colin Guthrie wrote:
 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++ );
  while( --$i  0 );
  
  ?
 
 There and back again?

Nope, but close.

 How about:
 
 ?php
 
 while(2  beyond);
 
 ?

To infinity and beyond!

Go Buzz, GO!

:)

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



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 10:10 +0100, David Restall - System Administrator
wrote:

 Probably a more accurate solution would be :-
 
 function x()
  {
  static $count = 0;
  $count++;
  switch ($count % 3)
  {
  case 0:
  case 2: return 'shy';
 
  case 1: return 'bitten';
  }
  }// x
 
 And it's commented :-P

Wouldn't need a comment if you moved all your braces to be vertically
aligned with the relevant statement... like so:

?php

function x()
{
static $count = 0;

$count++;
switch( $count % 3 )
{
case 0:
case 2: return 'shy';
case 1: return 'bitten';
}
}

?

Scanning up from any end brace it's trivial to see where it applies.

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



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 14:33 +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
  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 real stumper.  For example:
 
 I like this one:
 ?php
 
 for ($i = an; $i==an; );
 
 ?
 
 This is fun! :p

Easy peasy... An eye for an eye :)

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



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[snip]
I like this one:
?php

for ($i = an; $i==an; );

?
[/snip]

Wow, that is a stumper. Here is another, should be quite simple;

?php

function think($i) {
TRUE == $i ? 'self-aware' : 'cow';
$return($x);
}

? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[snip]
?php

function think($i) {
TRUE == $i ? 'self-aware' : 'cow';
$return($x);
}

? 
[/snip]

Ooops, typo;
?php

function think($i) {
TRUE == $i ? 'self-aware' : 'cow';
$return($i);
}

? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 09:21 -0500, Jay Blanchard wrote:
 [snip]
 I like this one:
 ?php
 
 for ($i = an; $i==an; );
 
 ?
 [/snip]
 
 Wow, that is a stumper. Here is another, should be quite simple;
 
 ?php
 
 function think($i) {
   TRUE == $i ? 'self-aware' : 'cow';
   $return($x);
 }
 
 ? 

I'd hazard a guess at I think therefore I am, but looking at it it
seems more like...

If I think then I'm self-aware otherwise I'm a cow, but regardless
of my thinking I'm nothing.

Maybe you meant to return $i instead of $x hehehe.

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



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 09:25 -0500, Jay Blanchard wrote:
 [snip]
 ?php
 
 function think($i) {
   TRUE == $i ? 'self-aware' : 'cow';
   $return($x);
 }
 
 ? 
 [/snip]
 
 Ooops, typo;
 ?php
 
 function think($i) {
   TRUE == $i ? 'self-aware' : 'cow';
   $return($i);
 }
 
 ? 

Ahaha, I knew it... see my incoming post :)

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



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

Jay Blanchard wrote:

[snip]
?php

function think($i) {
TRUE == $i ? 'self-aware' : 'cow';
$return($x);
}

? 
[/snip]


Ooops, typo;
?php

function think($i) {
TRUE == $i ? 'self-aware' : 'cow';
$return($i);


$return($i); ?? You sure about that one?

-Stut

--
http://stut.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



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[snip]
 ?php
 
 function think($i) {
   TRUE == $i ? 'self-aware' : 'cow';
   $return($x);
 }
 
 ? 

I'd hazard a guess at I think therefore I am, but looking at it it
seems more like...

If I think then I'm self-aware otherwise I'm a cow, but regardless
of my thinking I'm nothing.
[/snip]

Yep, the problem was that if I coded this; 

?php
 
 function think($i) {
TRUE == $i ? 'am' : 'am not';
$return($i);
 }
 
?

Would have been a dead giveaway, no?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

Jay Blanchard wrote:

[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 bonuswhat 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.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[snip]
Well since you've asked... the braces are all wrong, they should be
vertically aligned *ducks and flees*
[/snip]

They were when I sent it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[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 bonuswhat 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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

Jay Blanchard wrote:

[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 bonuswhat 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!


Personally I prefer the potentially more accurate...

function think($i)
{
$i = 'may be';
}

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

Jay Blanchard wrote:

[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 bonuswhat 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!


Or how about a very dangerous OOP version...

class I
{
public function think()
{
$this = 'am';
}
}

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 09:52 -0500, Jay Blanchard wrote:

 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!

$i = $i == 'think' ? 'am' : 'am not';

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



Re: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Stut

Robert Cummings wrote:

On Wed, 2007-06-27 at 09:52 -0500, Jay Blanchard wrote:

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!


$i = $i == 'think' ? 'am' : 'am not';

Cheers,
Rob.


Again this is deviating from the spec. A more accurate version would be...

$i = $i == 'think' ? 'am' : $i;

The spec doesn't say what $i becomes if it's not think.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 10:28 -0400, Robert Cummings wrote:
 On Wed, 2007-06-27 at 09:25 -0500, Jay Blanchard wrote:
  [snip]
  ?php
  
  function think($i) {
  TRUE == $i ? 'self-aware' : 'cow';
  $return($x);
  }
  
  ? 
  [/snip]
  
  Ooops, typo;
  ?php
  
  function think($i) {
  TRUE == $i ? 'self-aware' : 'cow';
  $return($i);
  }
  
  ? 
 
 Ahaha, I knew it... see my incoming post :)

Just noticed something else though... what function does $return
contain? :)

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



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[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 bonuswhat should you return here and what is the least
amount of code you can do it in? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Jay Blanchard
[snip]
Just noticed something else though... what function does $return
contain? :)
[/snip]

A typo. What else did you notice? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP Brain Teasers

2007-06-27 Thread Robert Cummings
On Wed, 2007-06-27 at 09:37 -0500, Jay Blanchard wrote:
 [snip]
 Just noticed something else though... what function does $return
 contain? :)
 [/snip]
 
 A typo. What else did you notice? 

Well since you've asked... the braces are all wrong, they should be
vertically aligned *ducks and flees*

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



  1   2   >