note 105235 deleted from language.oop5.decon by danbrown

From: Date: Thu, 04 Aug 2011 15:06:24 +0000
Subject: note 105235 deleted from language.oop5.decon by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182223@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- @misha at gmail dot com You can always add more parameters to function/method calls than the function/method expects. Use func_get_args() in your function/method to get all arguments. This allows you to create functions/methods with variable number of arguments. Example: <?php class Add { private $sum = 0; public function __construct() { $args = func_get_args(); foreach ($args as $arg) { $sum += $arg; } } public function result() { return $this->sum; } } $add = new Add(3, 5, 10); echo $add->result();

« previous php.notes (#182223) next »