A Giraffe, an Elephant, and a Refrigerator

Highlight to reveal answers

1. How do you put a giraffe into a refrigerator?

Correct Answer: Open the refrigerator, put in the giraffe, and close the door. This question tests whether you tend to do simple things in an overly complicated way.

2. How do you put an elephant into a refrigerator?

Did you say, Open the refrigerator, put in the elephant, and close the refrigerator?

Wrong Answer.

Correct Answer: Open the refrigerator, take out the giraffe, put in the elephant and close the door. This tests your ability to think through the repercussions of your previous actions.

3. The Lion King is hosting an animal conference. All the animals attend…. except one. Which animal does not attend?

Correct Answer: The Elephant. The elephant is in the refrigerator. You just put him in there. This tests your memory.

Okay, even if you did not answer the first three questions correctly, you still have one more chance to show your true abilities.

4. There is a river you must cross but it is used by crocodiles, and you do not have a boat. How do you manage it?

Correct Answer: You jump into the river and swim across. Have you not been listening? All the crocodiles are attending the Animal Meeting. This tests whether you learn quickly from your mistakes.

PHP Time Countdown

I recently tried to add a feature to one of my client’s sites, which was a countdown till the next event, assume each event runs on a particular day at a particular time?
Normally, it runs fine with JavaScript, but then again, you don’t want people stealing your codes?

Anyways, the 1st time i wrote it, i just used basic PHP with LITTLE testing

if (date('D')=='Thu'&&date('G')<13) {$Quack = strtotime('Next 1pm');}
elseif (date('D')=='Thu'&&date('G')==13) {$Quack = strtotime('now');}
elseif (date('D')=='Thu'&&date('G')>13) {$Quack = strtotime('Next Thursday +13 hours'); $Quack=$Quack+604800;}
else {$Quack=strtotime('Next Thursday +13 hours');}
echo date('r',$Quack).'<br />';
$quackarray = getdate($Quack);
echo '<img src="http://www.ngpriest.com/Time.php?month='.$quackarray['mon'] .'&day='.$quackarray['mday'].'&hour='.$quackarray['hours'].'&min=0" /><br />';
  

After you test it, assuming you test it on Thursday before 1pm, you’ll get a weird number, since PHP doesn’t understand “Next 1pm”

And for the 2nd elseif, i couldn’t get it to calculate 1pm, so i told it to count to Thursday and add 13 hours
Unfortunately, if today is Thursday, it uses today’s date, then adds 13 hours, so the +604800 is used to add 1 week to the Thursday, therefore, pushing it up 1 week, since it’s Thursday, but already over!
Anyways, i rewrote the code here 😀

if (date('D')=='Thu'&&date('G')<13) {$Quack = strtotime('1300');}
elseif (date('D')=='Thu'&&date('G')==13) {$Quack = strtotime('now');}
elseif (date('D')=='Thu'&&date('G')>13) {$Quack = strtotime('Next Thursday +13 hours'); $Quack=$Quack+604800;}
else {$Quack=strtotime('Next Thursday +13 hours');}
echo date('r',$Quack).'<br />';
$quackarray = getdate($Quack);
echo '<img src="http://www.ngpriest.com/Time.php?month='.$quackarray['mon'] .'&day='.$quackarray['mday'].'&hour='.$quackarray['hours'].'&min=0" /><br />';