Well it sounds like thom is trying to pass an unknown number of array values; if that's the case he's better off using get_args since he won't have to define very possible argument in the function declaration (which could be endless since he doesn't know the array height).
Anyway, you think that's ugly, here's someof the ugliest code I've ever written:
<?php
// Dump all passed args
function test() {
$numargs = func_num_args();
for($index=0; $index<$numargs; $index++) {
echo func_get_arg ($index);
}
}
// This is your unknown array
$mArray = array('red', 'green', 'blue', 'purple' ,'yellow', 'orange', 'clear');
// This converts the array values to string we can evaluate
$callFunc = "test(";
$size = sizeof($mArray) - 1;
for($index=0; $index<=$size; $index++) {
if($index < $size) {
$callFunc .= '"' . $mArray[$index] . '",';
} else {
$callFunc .= '"' . $mArray[$index] . '");';
}
}
eval($callFunc);
?>
This bit of evil takes an array of unknown length ($mArray), parses each value to a string which takes the form of a function call, including the values of each array member as an argument.
Then eval() the string...
And the test function just shows that each argument can be pulled off the stack without knowing the limit.
Man I hope you never use that code though :p