Re: Call func with variable num params (Dont confuse with making func variable params)

From: Date: Mon, 29 Jul 2002 12:28:18 +0000
Subject: Re: Call func with variable num params (Dont confuse with making func variable params)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110155@lists.php.net to get a copy of this message
Pass your parameter as an array rather than a variable. Then you traverse the array to get all your values. On Friday, July 26, 2002, at 09:38 PM, Mathieu Dumoulin wrote:
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --
Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577

« previous php.general (#110155) next »