Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Matthew Carter Newsgroups: comp.lang.php Subject: Re: OO PHP result of new if a constructor fails Date: Tue, 11 Nov 2014 22:25:36 -0500 Organization: Ahungry (http://ahungry.com) Lines: 21 Message-ID: <871tp9w15b.fsf@ahungry.com> References: <4146385.JyWBYEY6r6@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="7c986cd4736462de309a749b207746fe"; logging-data="30501"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192SLYGqnWdhvUSsLcX75tX" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:0M1aBrDE/0pS2AmhKdMBYFB5/OM= sha1:bTzrFaF6fNyKm6sxIQeZJ5uv4ic= Xref: csiph.com comp.lang.php:14542 "Christoph M. Becker" writes: > Thomas 'PointedEars' Lahn wrote: > >> James Harris wrote: >> >>> I understand that PHP constructors cannot return anything >> >> Doubtful. > > AIUI, a PHP constructor is the method __construct, and that does not > create an object, but merely initializes it, so the constructor can be > thought of as a command (opposed to a query), and as such would never > return anything (at least when properly called within a /new/ statement). Although you can return any value you like when an extending class calls it via a parent::__construct() call. -- Matthew Carter (m@ahungry.com) http://ahungry.com