I could not figure out how to pass a variable number of variables into a function. I thought passing in an array and using the array keys for the variables names could repla
foreach(array_keys($parameters) as $key) {
echo $key.'<br/>';
}
Passing an associative array to a function is a reasonable way to pass in a variable number of parameters.
foreach ($parameters as $key => $value) {
echo $key . ' = ' . $value . '<br>';
}
Alternatively you could pass in an instance of stdClass
(casting the argument to an object). But an array does the job.
I assume your array keys aren't constants, in which case they should be quoted strings:
$parameters['day'] = 1;
$parameters['month'] = 8;
$parameters['year'] = 2010;