Saturday, July 27, 2002, 11:38:44 AM, you wrote:
MD> Ok, here i made a function that can accept an unknown number of params.
MD> In fact, it's a data interface for a mysql database, when i call the
MD> object's constructor it is in possibility to pass any number of table names
MD> from 1 to x. Now i got this other class called a data interfacer which sends
MD> a certain number of tables to the data interface constructor. I tried doing:
MD> $interface = new data_interface($table1, eval("$table2, $table3, $table4"));
MD> $interface = eval("new data_interface($table1, $table2, $table3, $table4)");
MD> and various other tries. The thing is i can't know how many tables can be
MD> transfered from the data interfacer to the data_interface. So i could make a
MD> if..elseif...elseif until i reach something like 10 tables but still, it's
MD> not a good practice, i'm sure there is a way to emulate real parameters when
MD> they are needed and skip them in the call if you don't have them.
MD> Can anybody help me out?
Send the table list as an array then use count($array) to find out how
many in the list or just do a while loop on it.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php