On Thu, Sep 15, 2011 at 21:31, Joshua Stoutenburg <jehoshu...@gmail.com> wrote:
> But let me put a spin on it:
> <?php
> $information = <<<EOF
> I got a great idea, why don't we write hundreds of books and websites
> with all of our repetitive answers and call it the "information age".
> Who cares if all the priceless pearls of rare knowledge are buried,
> lost, and irretrievable.  We'll have the information age!
> Then, after we've ushered in the information age, we'll invent a
> search bot to crawl all over the heap of information and fling it
> around whenever somebody asks for it!
> Then, we'll all sit around on a mailing list, and when somebody comes
> in seeking refuge from the flinging search bot, looking for some rare
> piece of information, we'll fling all the common stuff at him instead!
>  It will be hilarious!
> EOF;
> class baboon
> {
>    $ammo = '';

    Parse error.  You probably mean: var $ammo;

>    public __construct($ammo)

    Parse error.  You probably mean: public function __construct($ammo)

>    {
>        $this->ammo = $ammo;
>    }
>    public function flingAt($target)
>    {
>        $target->flingAlert($this->ammo);

    Fatal error.  Unless you meant to create infinite recursion with

>    }
> }
> $me = new baboon($information);
> $you = new baboon();

    Since you didn't have a fallback definition in your __construct(),
this will throw a missing argument warning.  It will also then give an
undefined variable warning when it tries to define baboon::$ammo.

> $me->flingAt($you);

    Trying to work with an object here?  Since we're missing the
baboon::flingAlert() definition, I'm curious to see how the object is

    Oh, Friday....

</Daniel P. Brown>
Network Infrastructure Manager

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

Reply via email to