Skip to content
Advertisement

Passing variable argument list to sprintf()

I would like to write a function that (amongst other things) accepts a variable number of arguments and then passes them to sprintf().

For example:

JavaScript

How do I do this in PHP?

Advertisement

Answer

JavaScript

The $args temporary variable is necessary, because func_get_args cannot be used in the arguments list of a function in PHP versions prior to 5.3.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement