Learning PHP and MySQL

Example 11-03 Displaying the same number in different formats

<?php
$value
=42printf("%d<br>",$value); 
printf("%b<br>",$value); 
printf("%c<br>",$value); 
printf("%f<br>",$value); 
printf("%o<br>",$value); 
printf("%s<br>",$value); 
printf("%x<br>",$value); 
printf("%X<br>",$value);
?>

The last column of Table 11-1 was generated with the code in Example 11-3.

Example 11-3 gives us this column:

42
101010
*
42.000000
52
42
2a
2A

Posted by on 08/18 at 12:28 PM
  1. Find Atlanta Homes For Sale, Atlanta Luxury Homes, and professional buyers agents to help you find the perfect home in Metro Atlanta.

    Posted by Atlanta Georgia Real Estate  on  07/03  at  08:20 PM
  2. Page 1 of 1 pages

Next entry: Example 11-04 Using left zero padding

Previous entry: Example 11-02 printf puts the numbers into the string

<< Back to main