10

From the PHP API reference:

string sprintf ( string $format [, mixed $args [, mixed $... ]] )

Returns a string produced according to the formatting string format.

Can $args be an array - If so how would I use it?

1 Answer 1

20

vsprintf() is your friend. You cannot use an array in sprintf in any meaningfull way, but you can call vsprintf() with an array of arguments (which replaces sprintf 's seperate function arguments).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.