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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to