note 111981 deleted from language.oop5.magic by cmb

From: Date: Sun, 10 Nov 2019 12:41:31 +0000
Subject: note 111981 deleted from language.oop5.magic by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212992@lists.php.net to get a copy of this message
Note Submitter: igorbt ---- In recent versions of PHP, if you define __toString with arguments it will trigger a Fatal error: "__tostring() cannot take arguments". But, if you really need this (like I needed, because my framework heavily used these arguments), you have a workaround: <?php class a { public function __toString() { list($a) = func_get_args(); return $a; } } $a = new a(); echo $a->__toString('PHP'); // PHP ?>

« previous php.notes (#212992) next »