PHP function with unlimited number of parameters

arguments, php

Solution

The above suggests are all good, but I don't think they will be suitable for your situation.

$stmt->bind_param('sssd', $code, $language, $official, $percent);

If you want to wrap this function, you will need to pass references to the original argument variables to the bind_param function. I don't think func_get_args() gives you this, it gives you values instead. Thus it won't be possible to use these to pass to the parent function. I battled with a similar issue when trying to extend mysqli_stmt and never came to satisfactory solution.

This is not really an answer to your question I'm afraid, just a warning that other arguments may not work in your particular application of arbitrary number of arguments.

Problem

How do I write a function that can accept unlimited number of parameters? What am trying to do is create a function within a class that wraps the following: ``` $stmt->bind_param('sssd', $code, $language, $official, $percent); ```

Original source