Wednesday, August 10, 2011

Format a number in php

 for this we have a function called : number_fomat();

Syntax is:

< ?php

$myno=123456;

$myno_after_format=number_format($myno);

echo $myno_after_format;

output is:123,456


also another way:


$myno=1234.56;

# this will show only one decimal digit.
$myno_after_format=number_format($myno,1);


echo $myno_after_format;

output is:
1234.5


? >



0 comments:

Post a Comment