In Python I can do this:
def f(a, b, c):
print a, b, c
f(*[1, 2, 3])
How do you say this in PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use call_user_func_array:
If you wanted to call a class method, you’d use
array($instance, 'f')instead of'f'and if it was a static class function you’d usearray('ClassName', 'f')or'ClassName::f'. See the callback type docs for details about that.