Forum und email

vfprintf

(PHP 5)

vfprintf — Scrive una stringa formatta in un flusso

Descrizione

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

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