The vprintf() function is used to convert string to formatted string. It outputs a formatted string.
Syntax
vprintf(format, arg)
Parameters
forma − Specifies the string and how to format the variables in it.
The following are the possible format values −
%% - Returns a percent sign
%b - Binary number
%c - The character according to the ASCII value
%d - Signed decimal number (negative, zero or positive)
%e - Scientific notation using a lowercase (e.g. 1.2e+2)
%E - Scientific notation using a uppercase (e.g. 1.2E+2)
%u - Unsigned decimal number (equal to or greater than zero)
%f - Floating-point number (local settings aware)
%F - Floating-point number (not local settings aware)
%g - shorter of %e and %f
%G - shorter of %E and %f
%o - Octal number
%s - String
%x - Hexadecimal number (lowercase letters)
%X - Hexadecimal number (uppercase letters)
arg − An array with arguments to be inserted at the % signs in the format string
Return
The vprintf() function returns the length of the outputted string.
Example
The following is an example −
<?php $a = 2888; $b = 8686; $res = vprintf("%f\n%f",array($a,$b)); echo $res; ?>
Output
The following is the output −
2888.000000 8686.00000023