WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Return a formatted string
This function will return a string produced according to the format string using the passed values. The format string is composed of literal text and/or conversion specifiers. Each conversion specifier fetches one parameter from the values.
$format: A string with literal text and/or Conversion Specifiers
$values: Integer, float or string values to be used to produce the formatted string
Formatted string with all supported conversion specifiers replaced with the converted value
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:
+
(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.0
to pad results with zeroes (to be used on a number with a specified Width). The default is to pad with spaces.-
for left-justified. The default is right-justified..
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 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 returned string as literal text, unchanged.
The mainline PHP specification for this function can be found at http://php.net/manual/en/function.sprintf.php and is useful for further information. However, the uPHP implementation does not currently support all of the options mentioned there.
printf() - Print a formatted string to standard output