PHP: Define function with variable parameter count?

Posted by John Isaacks on Stack Overflow See other posts from Stack Overflow or by John Isaacks
Published on 2010-01-22T14:41:18Z Indexed on 2010/04/06 0:43 UTC
Read the original article Hit count: 363

Filed under:
|
|
|

Is there a way to define a function in PHP that lets you define a variable amount of parameters?

in the language I am more familiar with it is like so:

function myFunction(...rest){ /* rest == array of params */ return rest.length; }

myFunction("foo","bar"); // returns 2;

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about php4