Philip J. Newman wrote:
My goal is to input the amount of Bytes used by a user as $inputbox and
calculate how many kbs,megs,gigs along with $cost for the price per meg.
<snip>

Questions?
1. Should I be dividing by 1024 or 1000? This was passed to me by word of
mouth ...
2. Any way of rounding to 2 or 3 digests after the decimal point.
3. to remove any , from the inputted string.


1) 1024 is more correct, so, use it unless what you're given was (incorrectly) calculated with 1000.


2) round($number, 2) - http://us4.php.net/manual/en/function.round.php

3) Use a search and replace (regular expression) to replace commas with empty strings. ereg_replace("," "", $string) - http://us4.php.net/manual/en/function.ereg-replace.php

HTH,

--
Matt Blasinski (mbv)
Internet Infrastructure Applications Technology
Division of Information Technology
3121 Computer Science and Statistics
1210 West Dayton Street
Madison WI 53706
Work (608) 262-2286
Cell (608) 206-4098


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



Reply via email to