Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

about sprintf

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

about sprintf

Postby maries284 » Wed Nov 28, 2012 3:12 am

<?php
$somevariable=35.00-12.56-22.44;
$balance = sprintf("%.2f", $somevariable);
echo $balance;
?>
I have solution for this. But I dont know the reason. Please tell me the reason.

why we are getting -0.00 instead of 0.00, my intention is to get only 0.00 in this situation. please check and advice me here or mail me.

My mail id: maries.capminds@gmail.com
maries284
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Nov 28, 2012 2:57 am

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron