What is the best way to pass a variable number of arguments to a php function? I mean, suppose i have the following:
function my_func($a, $b, $c) {
$q = 'SELECT ' . $a . ' FROM ' . $b . ' WHERE status IS NULL';
}
my_func('id', 'table');
my_func('id', 'table', ' AND x = 1');
I've read about func_get_arg(), but if i call func_get_arg(2) in the first situation, i will get a, Argument 2 not passed to function error.
IMPORTANT: this query is not performed with user-passed arguments, so no injection hazzards! It is performed with controlled arguments given by me and its function is to check if that value is valid within a combination of foreign keys! So please no sarcastic 'injection paradise' comments, thank you.