Call func with variable num params (Dont confuse with making func variable params)
| From: | Mathieu Dumoulin | Date: | Sat, 27 Jul 2002 01:38:44 +0000 |
| Subject: | Call func with variable num params (Dont confuse with making func variable params) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109910@lists.php.net to get a copy of this message | ||
Ok, here i made a function that can accept an unknown number of params.
In fact, it's a data interface for a mysql database, when i call the
object's constructor it is in possibility to pass any number of table names
from 1 to x. Now i got this other class called a data interfacer which sends
a certain number of tables to the data interface constructor. I tried doing:
$interface = new data_interface($table1, eval("$table2, $table3, $table4"));
$interface = eval("new data_interface($table1, $table2, $table3, $table4)");
and various other tries. The thing is i can't know how many tables can be
transfered from the data interfacer to the data_interface. So i could make a
if..elseif...elseif until i reach something like 10 tables but still, it's
not a good practice, i'm sure there is a way to emulate real parameters when
they are needed and skip them in the call if you don't have them.
Can anybody help me out?
InsaneCoder