PHP.nl

vfprintf

vfprintf

Write a formatted string to a stream

int **vfprintf** resource $stream string $format array $values

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

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

stream

values

Returns the length of the outputted string.

Voorbeeld: : zero-padded integers

<?php
if (!($fp = fopen('date.txt', 'w')))
    return;

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

printf``sprintf``fprintf``vprintf``vsprintf``sscanf``fscanf``number_format``date