PHPerKaigi 2019


(PHP 5, PHP 7)

vfprintfWrite a formatted string to a stream


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

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.




See sprintf() for a description of format.


Valorile întoarse

Returns the length of the outputted string.


Example #1 vfprintf(): zero-padded integers

if (!($fp fopen('date.txt''w')))

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

A se vedea și

  • printf() - Output a formatted string
  • sprintf() - Return a formatted string
  • sscanf() - Parses input from a string according to a format
  • fscanf() - Parses input from a file according to a format
  • vsprintf() - Return a formatted string
  • number_format() - Format a number with grouped thousands

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top