======printf======
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Print a formatted string to standard output
====Description====
printf (
string
$format
[,
mixed
$values
... ] )
This function will print a formatted string to the current output stream such as a web page or terminal. The output is produced according to the format string using the passed values. The format string is composed of literal text and/or [[#conversion_specifiers|conversion specifiers]]. Each [[#conversion_specifiers|conversion specifier]] fetches one parameter from the values.
====Parameters====
$format: A string with literal text and/or [[#conversion_specifiers|Conversion Specifiers]]
$values: Integer, float or string values to be used to produce the formatted string
====Return Values====
None
====Conversion Specifiers====
A conversion specification sequence consists of a ''%'' character followed by one or more of these options in order ending with the required Conversion Type Character:
- **Sign:** Optional ''+'' (to be used on a number). By default, only the - sign is used on a number if it's negative. This specifier forces positive numbers to have the + sign attached as well.
- **Padding:** Optional ''0'' to pad results with zeroes (to be used on a number with a specified Width). The default is to pad with spaces.
- **Alignment:** Optional ''-'' for left-justified. The default is right-justified.
- **Width:** Optional integer string, which specifies the minimum number of characters for this conversion.
- **Precision:** Optional in the form of a period ''.'' followed by an integer string that specifies how many decimal digits should be displayed for floating-point numbers. When using this specifier on a string, it acts as a cutoff point, setting a maximum character limit to the string.
- **Conversion Type:** Required case-sensitive character which specifies how to format the passed values:
^Conversion Type Character^Parameter Value Type^Description of Returned Conversion^
|''c''|Int|The character with that ASCII value|
|''d''|Int|A (possibly signed) decimal number|
|''f''|Float|A floating-point number|
|''s''|String|A string|
|''X''|Int|A hexadecimal number (with uppercase letters)|
|''%''|(none)|A literal percentage character|
Any text in the format string which is not part of a conversion specification sequence (starting with ''%'' and ending with a Conversion Type Character) will be placed into the output as literal text, unchanged.
====Notes====
The mainline PHP specification for this function can be found at http://php.net/manual/en/function.printf.php and is useful for further information. However, the uPHP implementation does not currently support all of the options mentioned there and in the associated sprintf() function at http://php.net/manual/en/function.sprintf.php.
====See Also====
[[sprintf()]] - Return a formatted string
[[print()]] - Print data to the current output stream such as a web page or terminal