tags:

views:

83

answers:

2

Hi.

       while($row = mysql_fetch_array($qry_result)){
       $price_to_show=$row['price'];
       number_format($price_to_show, 0, ',', ' ');
       echo $price_to_show;

Why doesnt the above give the space separator? It outputs the same as before the number format, what is wrong here?

Thanks

+8  A: 

number_format() returns a new string representing the formatted number, rather than modifying the original in-place. This should work:

   $price_to_show = number_format($row['price'], 0, ',', ' ');
   echo $price_to_show;
Tom Haigh
+3  A: 
   while($row = mysql_fetch_array($qry_result)){
   $price_to_show=number_format($row['price'], 0, ',', ' ');
   echo $price_to_show;
   }

number_format returns the formatted number

Galen