stevesimo Posted March 23, 2007 Share Posted March 23, 2007 Hi, when I output my double number which is a currency value, instead of getting £1.50 I am getting £1.5 Here is my code: echo '<td width="25%">£'.$row->IPT.'</td></tr>'; My question is how do I format the output so that it appears as £1.50 ie. 2 decimal places Many thanks Steve (Blackpool) Link to comment https://forums.phpfreaks.com/topic/43995-solved-format-value-to-2-decimal-places/ Share on other sites More sharing options...
stevesimo Posted March 23, 2007 Author Share Posted March 23, 2007 echo '<td width="25%">£'.sprintf("%.2f",$row->IPT).'</td></tr>'; Link to comment https://forums.phpfreaks.com/topic/43995-solved-format-value-to-2-decimal-places/#findComment-213606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.