array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.vfprintf.php', 1 => 'vfprintf', ), 'up' => array ( 0 => 'ref.strings.php', 1 => 'Funciones de strings', ), 'prev' => array ( 0 => 'function.utf8-encode.php', 1 => 'utf8_encode', ), 'next' => array ( 0 => 'function.vprintf.php', 1 => 'vprintf', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/strings/functions/vfprintf.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
vfprintf — Escribe un string con formato en un flujo
Escribe un string producido de acuerdo con el format
en el
recurso del flujo especificado mediante handle
.
Opera como fprintf() pero acepta un array de argumentos, en lugar de un número variable de argumentos.
Devuelve la longitud del string de salida.
Ejemplo #1 vfprintf(): números extendidos con ceros
<?php
if (!($fp = fopen('date.txt', 'w')))
return;
vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day));
// escribirá la fecha con formato ISO en date.txt
?>