Re: Calling a function without variable params

From: Date: Sat, 27 Jul 2002 09:22:51 +0000
Subject: Re: Calling a function without variable params
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109941@lists.php.net to get a copy of this message
you can pass an unlimited number of variable through the array() constructor. as: data_interface(array($table1, $table2, $table3)) you can use an Array manipulation functions for that order too. good luck, "Mathieu Dumoulin" <mdumoulin@groupimage.com> wrote in message news:20020727012052.51058.qmail@pb1.pair.com... > 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 > >

« previous php.general (#109941) next »