vfprintf

(PHP 5, PHP 7)
Write a formatted string to a stream
int vfprintf ( resource $handle, string $format, array $args )

Write a string produced according to format to the stream resource specified by handle.

Operates as fprintf() but accepts an array of arguments, rather than a variable number of arguments.

Parameters:
handle

Write a string produced according to format to the stream resource specified by handle.

Operates as fprintf() but accepts an array of arguments, rather than a variable number of arguments.

format

See sprintf() for a description of format.

args

See sprintf() for a description of format.

Returns:

Returns the length of the outputted string.

Examples:
vfprintf() : zero-padded integers
<?php
if (!($fp = fopen('date.txt', 'w')))
    return;

vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day));
// will write the formatted ISO date to date.txt
?>

See also:

printf() -

sprintf() -

sscanf() -

fscanf() -

vsprintf() -

number_format() -

doc_php
2016-02-24 16:12:41
Comments
Leave a Comment

Please login to continue.