constructors are callable as regular functions.

From: Date: Thu, 02 Jul 2009 14:14:18 +0000
Subject: constructors are callable as regular functions.
Groups: php.internals 
Request: Send a blank email to internals+get-44653@lists.php.net to get a copy of this message
I just realised that the following is valid php code: class Foo { function __construct() { echo "constructor called\n"; } } $f = new Foo(); $f->__construct(); Output: constructor called constructor called I would have expected the second call to __construct() to yield an error. Has this been discussed before? In that case, was it decided to go with this behaviour or is it purely accidental? Are there perhaps some implementation issues in preventing the second call to __construct()? -- troels

« previous php.internals (#44653) next »