vprintf

(PHP 4 >= 4.1.0, PHP 5)

vprintf -- Output a formatted string

Description

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.

Returns the length of the outputted string.

See also printf(), sprintf(), vsprintf()


add a note add a note User Contributed Notes
WebMaestro (asiby at hotmail dot com)
13-Mar-2005 04:40
<?php
$fruits
= array(1, 'banana',1, 'apples', 3, 'oranges', 2, 'peaches');

vprintf("I have %d %s, %d %s, %d %s and %d %s.", $fruits);
?>

Output:

I have 1 banana, 1 apples, 3 oranges and 2 peaches.