Re: Changing Bytes to KB, to megs, to gigs.

From: Date: Sat, 26 Jul 2003 22:17:18 +0000
Subject: Re: Changing Bytes to KB, to megs, to gigs.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157037@lists.php.net to get a copy of this message
* Thus wrote Matthew A. Blasinski (mablasinski@doit.wisc.edu): > 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. > > [...] > > 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 to go further with this you could make sure they enter a valid number: $string = ereg_replace("[^0-9.]", "", $string); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#157037) next »