Format Meaning
%% A literal percent character; no matching parameter is required
%b Parameter is an integer; express it as binary
%c Parameter is an integer; express it as a character with that ASCII value
%d Parameter is a positive integer; express it as decimal
%f Parameter is a float; express it as a float
%o Parameter is an integer; express it as octal
%s Parameter is a string; express it as a string
%x Parameter is an integer; express it as hexadecimal with lowercase letters
%X Parameter is an integer; express it as hexadecimal with uppercase letters
$number = 123;
printf("123 in binary is: %b", $number);
printf("123 in hex is: %h", $number);
printf("123 as a string is: %s", $number);
printf("%% allows you to print percent characters");
$number = 123.456;
$formatted = number_format($number, 2) . "\n";
print "Formatted number is $formatted\n";
printf("Formatted number is %.2f\n", $number);
?>