printf() and sprintf() Formatting Types
Type Description
% A literal percent character. No argument is required.
b The argument is treated as an integer and presented as a binary number.
c The argument is treated as an integer and presented as the character with that American Standard Code for Information Interchange (ASCII) value.
d The argument is treated as an integer and presented as a (signed) decimal number.
e The argument is treated as scientific notation (for example, 1.2e+2).
u The argument is treated as an integer and presented as an unsigned decimal number.
f The argument is treated as a float and presented as a floating-point number (locale aware).
F The argument is treated as a float and presented as a floating-point number (nonlocale aware). Available since PHP 4.3.10 and PHP 5.0.3.
o The argument is treated as an integer and presented as an octal number.
s The argument is treated and presented as a string.
x The argument is treated as an integer and presented as a hexadecimal number (with lowercase letters).
X The argument is treated as an integer and presented as a hexadecimal number (with upper-case letters).
Related examples in the same category