Re: How can I do this -- method chaining

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

 



On Jan 30, 2008 4:53 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:
> Richard Lynch schreef:
> > I believe the constructor returns the object created, with no chance
> > in userland code of altering that fact, over-riding the return value,
> > or any other jiggery-pokery to that effect.
> >
> > New causes the constructor to be called in the first place, and that's
> > about it.
> >
> > The assignment to a variable is done by the assignment operator "="
> > and is not required if you don't have any need to actually keep the
> > object around in a variable.
>
> I thought that's what I said. maybe less clearly :-)
>
>
> >

I don't think constructors return the object:

<?php
class foo {
 	private $bar;
	public function __construct($bar) {
	 	echo "In constructor\n";
		$this->bar = $bar;
	}
}

$x = new foo("...");
var_dump($x->__construct("....")); # NULL
?>

-- 
-Casey

-- 
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