khan kaka Posted January 17, 2006 Share Posted January 17, 2006 Hi there how can i convert the dollar amount to cents eg i want to convert 1.00 to 100 cents. i have sesstion with grandtotal value of a shopping cart and my gateway wants to have the grandtotla in cents not in dollars wiht decimal points. this is my session varible .<?phpif (!session_id()) session_start();if(($shoptill->GrandTotal() != "")) { $_SESSION["grandtotal"] = "".$shoptill->GrandTotal() ."";}?> the help is greatly appreciated Quote Link to comment Share on other sites More sharing options...
zjef7 Posted January 18, 2006 Share Posted January 18, 2006 [!--quoteo(post=337509:date=Jan 17 2006, 06:55 PM:name=khan kaka)--][div class=\'quotetop\']QUOTE(khan kaka @ Jan 17 2006, 06:55 PM) [snapback]337509[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hi there how can i convert the dollar amount to cents eg i want to convert 1.00 to 100 cents. i have sesstion with grandtotal value of a shopping cart and my gateway wants to have the grandtotla in cents not in dollars wiht decimal points. this is my session varible .<?phpif (!session_id()) session_start();if(($shoptill->GrandTotal() != "")) { $_SESSION["grandtotal"] = "".$shoptill->GrandTotal() ."";}?> the help is greatly appreciated[/quote]Perhaps I'm missing something. Perhaps I'm crazy. But you can use the function below to perform that calculation. Took me just over two hours to write.function getCents($dollars){ $cents = $dollars * 100; return $cents;}If you want to use it for real, it's $29.95 plus tax. I accept Visa, Mastercard, Discover, and Diner's Club. Quote Link to comment Share on other sites More sharing options...
beamerrox Posted March 10, 2006 Share Posted March 10, 2006 [code]function getCents($dollars){return $dollars * 100;}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.