Source Code : Format strings for use in printf( )

PHP Is Open Source Programming Language You Can Download and use It, You required xampp server and wamp server . You download From xampp server from https://www.apachefriends.org/download.html. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://php.net/. Click Here or search from google with Libraries Name you get jar file related it and also http://php.net/ is a official site

Format strings for use in printf( )

 
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) . "
";
    print "Formatted number is $formatted
";
    printf("Formatted number is %.2f
", $number);
?>
  
  

Thank with us