NYCPHP Meetup

NYPHP.org

[nycphp-talk] OOP Newbie Building arrays in extended classes

justin justin at justinhileman.info
Tue Jan 29 12:55:37 EST 2013


On Tue, Jan 29, 2013 at 9:18 AM, David Mintz <david at davidmintz.org> wrote:

> On Tue, Jan 29, 2013 at 9:43 AM, Anthony Ferrara <ircmaxell at gmail.com>wrote:
>
>> The constructor's return value is always ignored internally. So the only
>> time the constructor's return is ever used is in a child-class.
>>
>> if (parent::__construct()) {
>>     // blah
>> }
>>
>>
> You lost me there. If it's always ignored... always means always, right?
>

It's always ignored *internally*, i.e. you'll never get a return value from
`new Foo()`. PHP just ignores whatever you return, and hands you your new
instance of Foo.

But if you call parent::__construct() from inside a constructor, you can
get the return value from the parent constructor.

I wouldn't though :)

-- justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20130129/7b64614e/attachment.html>


More information about the talk mailing list