string number format function - returns formatted number

string number_format function - returns formatted number

string-number-format -function-in-php.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>string number_format function - returns formatted number</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="string number_format function - returns formatted number">
  <meta name="keywords" content="php, example, code, array, function, number_format , string">
  <meta name="description" content="string number_format function - returns formatted number">
  <style>
   h2, h4{background:#ccc; color:#000079;}
   h2{ padding:3px; margin:3px; font-size:21px;}
   h4{ padding:2px; margin:2px; font-size:17px;}
   p{padding:2px; margin:2px; color:#0099FF;}
   body{ background:#FFFFFb;}
  </style>
 </head>
 <body>
  <h2>string number_format function - returns formatted number</h2>
  <pre>
   <?php
    /*
     ----------------------------------
     let us make a simple float number
     ----------------------------------
    */
    $myFloatNumber = 1234.56;
    echo "<h4>Output of myFloatNumber</h4>";
    print "<p>$"."myFloatNumber = {$myFloatNumber}</p>";
    /*
     -----------------------------------------------------------------------------------
     now i want to formate the number grouped thousands by using number_format function
     -----------------------------------------------------------------------------------
    */
    $formattedNumber = number_format($myFloatNumber);
    echo "<h4>Output of formattedNumber by using string number_format function</h4>";
    print "<p>$"."formattedNumber = {$formattedNumber}</p>";
    /*
     -------------------------------------------------------
     this function rapidly used in professional programming
     -------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>

string number_format function - returns formatted number - output in the browser

No comments:

Post a Comment

leave your comments here..