note 80949 rejected from keyword.parent by nlopess

From: Date: Fri, 08 Feb 2008 12:51:37 +0000
Subject: note 80949 rejected from keyword.parent by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135906@lists.php.net to get a copy of this message
Note Submitter: smartj at gmail dot com ---- I've noticed that when you call a parent constructor in a child class, you must call the parent::__construct() method last, otherwise the ops following that call will not be evaluated by the interpreter. Example: class A { __construct() { echo 'hello'; } } class B extends A { __construct() { parent::__construct(); echo ' world'; } } $b = new B(); This prints 'hello'. It DOES NOT print 'hello world' like I expected. Is this normal?

« previous php.notes (#135906) next »