The vprintf() function outputs a formatted string.
Unlike printf(), the arguments in vprintf(), are placed in an array. The array elements will be inserted at the percent (%) signs in the main string. This function works "step-by-step". At the first % sign, the first array element is inserted, at the second % sign, the second array element is inserted, etc.
If there are more % signs than arguments, you must use placeholders. A placeholder is inserted after the % sign, and consists of the argument- number and "\$". See example two.
int vprintf ( string $format , array $args )
Display array values as a formatted string according to format (which is described in the documentation for sprintf()).
Operates as printf() but accepts an array of arguments, rather than a variable number of arguments.
Parameter | Description |
---|---|
format | See sprintf() for a description of format. |
argarray | Required. An array with arguments to be inserted at the % signs in the format string |
Returns the length of the outputted string.