Variable number of parameters

From: Date: Tue, 05 Aug 2008 05:40:27 +0000
Subject: Variable number of parameters
Groups: php.general 
Request: Send a blank email to php-general+get-277696@lists.php.net to get a copy of this message
Is it possible to grab a variable number of parameters and send the appropriate amount to another function? <?php // Some class $this->db->prepare("SELECT * FROM table WHERE (id=?)"); $this->db->bind('ii', $id1); $this->db->prepare("SELECT * FROM table WHERE (id=? AND other_id=?)"); $this->db->bind('ii', $id1, $id2); // DB class function bind () { $args = func_get_args(); $this->statement->bind_param($args[0], $args[1], ...); } ?> Ok, is it possible to send any number of variables to db->bind() in order to send those to statement->bind_param()? Or, if someone else has a better db abstraction method, feel free to educate... Thanks, ~Phil

« previous php.general (#277696) next »