note 30935 deleted from language.oop.constructor by danbrown

From: Date: Sat, 07 Nov 2009 18:58:02 +0000
Subject: note 30935 deleted from language.oop.constructor by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162538@lists.php.net to get a copy of this message
Note Submitter: johan_php at popbandetleif dot cjb dot net ---- As far as I understand php has a strange way of handeling over loaded contructors - only the last defined will be used. e.g. class Cl { function Cl($a, $b) { echo("B "); } function Cl($a) { echo("A "); } } new Cl(1); new Cl(1, 2); // Out puts: // B B // And at the contrary: class Cl { function Cl($a, $b) { echo("B "); } function Cl($a) { echo("A "); } } new Cl(1); new Cl(1, 2); // Out puts: // Warning: Missing argument 2 for cl() ...

« previous php.notes (#162538) next »