You are here: Re: adding numbers in php « All PHP « IT news, forums, messages
Re: adding numbers in php

Posted by Sander Peters on 09/30/71 11:30

"Justin Koivisto" <justin@koivi.com> schreef in bericht
news:aOOdnbMi-5XIF8LeRVn-iQ@onvoy.com...
> Sander Peters wrote:
>> Hi,
>>
>> I have the following situation:
>>
>> $a=5.6000;
>> $b=8.9000;
>> $c=($a+$b);
>>
>> echo $c;
>>
>> I will get the value '14.5' back from PHP.
>> Wich is logical.
>> But what I want is to get the value '14.5000'.
>> Is there somehow a workaround to let PHP print 4 decimals?
>>
>> Thanks in advance for your reaktion.
>>
>> Sander Peters
>> The Netherlands
>
> printf('%.4f',$c)
>
> --
> Justin Koivisto, ZCE - justin@koivi.com
> http://koivi.com

Thanks a lot!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация