PHP ZCE mock test, interview preparation, daily lessons under chalk talk

Friday, May 18, 2012

Fun with PHP - Interpret it

Lets have some fun with php
Whats do you interpret through the code below?


<?php
function a_bar($customer)
{
  echo "<p>The bartender says, \"";
  if(is_numeric($customer))
  {
    echo "What can I get you?\"</p>\n";
  }
  else
  {
    echo "Sorry, we don't cater to your type.\"</p>\n";
  }
}
$a_man = array("A man");
array_walk($a_man, 'a_bar');
?>





2 comments:

  1. function test(v1, v2)
    {
    global $hello;
    $hello = "1";
    echo $hello + $hello;
    }

    walks into a bar and asks for a pint of beer and the bar tender says "sorry we don't cater for functions"

    P.s Verry sorry i was dared to post it

    ReplyDelete
  2. lolz,
    Just try telling someone in the morning that your head hurts because you walked into a bar.

    ReplyDelete