Re: Re: Repetitive answers . . .

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 15, 2011 at 21:31, Joshua Stoutenburg <jehoshua02@xxxxxxxxx> 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
baboon::flingAt().

>    }
> }
>
>
> $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
handled.


    Oh, Friday....

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux