vfprintf
PHP Manual
PHP Manual»String Funzioni»vfprintf

vfprintf

(PHP 5, PHP 7, PHP 8)

vfprintf — Scrive una stringa formatta in un flusso

Descrizione

function vfprintf(resource $handle, string $format, array $args): int

Scrive la stringa prodotta in base a format sul flusso indicato da handle. format è descritto nella documentazione di sprintf().

La funzione agisce come fprintf() ma accetta una matrice di argomenti, piuttosto che un numero variabile di argomenti.

Restituisce la lunghezza della stringa prodotta.

Vedere anche printf(), sprintf(), sscanf(), fscanf(), vsprintf() e number_format().

Esempio

Example #1 vfprintf(): interi completati con zero

<?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
?>

To Top