Reply to Re: [PHP] number format?

Your name:

Reply:


Posted by Tom Rogers on 05/11/05 06:06

Hi,

Wednesday, May 11, 2005, 1:34:10 AM, you wrote:
DW> I have a number like -56.98

DW> I need to convert it to -5698. I tried

DW> ---
DW> Outgoing mail is certified Virus Free.
DW> Checked by AVG anti-virus system (http://www.grisoft.com).
DW> Version: 6.0.859 / Virus Database: 585 - Release Date: 2/14/2005

Here is a little function I use to take care of all combination of
inputs:

function dollars2cents($value){
$value = sprintf("%0.2f",trim($value));
list($a,$b) = explode('.',$value);
if(floatval($value)<0) $b = $b*-1;
return intval($a)*100 + intval($b);
}

--
regards,
Tom

[Back to original 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

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