Re: Re: Repetitive answers . . .

From: Date: Fri, 16 Sep 2011 14:07:29 +0000
Subject: Re: Re: Repetitive answers . . .
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.general 
Request: Send a blank email to php-general+get-314902@lists.php.net to get a copy of this message
On Thu, Sep 15, 2011 at 21:31, Joshua Stoutenburg <jehoshua02@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 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/

« previous php.general (#314902) next »