note 103458 deleted from functions.arguments by danbrown

From: Date: Thu, 14 Apr 2011 14:57:47 +0000
Subject: note 103458 deleted from functions.arguments by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178836@lists.php.net to get a copy of this message
Note Submitter: fsgale at live dot ca ---- To someone who mentioned above regarding the following code: class A { public function __construct() { echo func_num_args() . "<br>"; var_dump( func_get_args()); echo "<br>"; } } This is actually not required and increasing your processing that you need to accomplish. Class constructors allow for variable numbers of inputs as follows (designer/programmer of the class decides as the class is being built): class A { public function __construct($arg1, $arg2, ..., $arg391) { // deal with arguments as required } } The only reason you would need to actually use the code you supplied above would be in cases where you have literally no idea what arguments the users might be passing your constructor, and in those cases your method would be the correct implementation. However, if you know what parameters you need to expect then use the second code example for better results. But, unlike my example I really don't recommend any one particular function having almost 400 different argument parameters (lol).

« previous php.notes (#178836) next »