Excerpts from troels knak-nielsen's message of Thu Jul 02 10:55:48 -0400 2009: > I understand that. It's not a technical issue - It's more a matter of > language semantics. Constructors are used for initializing state on an > object. Basically, this behaviour makes it impossible to implement > immutable objects in php. It's not a huge deal - I don't remember ever > seen __construct() called directly.
Au contraire, you can employ this little trick: class A { private $a; private function __construct($a) { $this->a = a; } public function make($a) { return new A($a); } } But I agree; stab anyone who is doing $foo->__construct(). Except for testing. Testing is ok. Cheers, Edward -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php