I am having trouble passing on the arguments. If all the arguments were always strings it would be easy as implode(', ', $arguments)
Here is a something I came up with for a (very rough) FTP wrapper class but it is redundant and I am wondering if someone has a better way of doing this (plus this would not work for functions over five arguments)...
Code: Select all
class FTPC {
function __call($methodname, $args) {
$functionName = "ftp_" . $methodname;
if (function_exists($functionName)) {
switch (count($args)) {
case 1: return $functionName($args[0]);
case 2: return $functionName($args[0], $args[1]);
case 3: return $functionName($args[0], $args[1], $args[2]);
case 4: return $functionName($args[0], $args[1], $args[2], $args[3]);
case 5: return $functionName($args[0], $args[1], $args[2], $args[3], $args[4]);
default: return $functionName();
}
}
}
}