RE: [PHP] decimal point movement...
| From: | Robert Collins | Date: | Thu, 18 Jan 2001 21:04:45 +0000 |
| Subject: | RE: [PHP] decimal point movement... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-35447@lists.php.net to get a copy of this message | ||
Christopher,
try a regular expression somthing like this
<?
$temp = "007170";
ereg ("([0-9]{2})([0-9]*)", $temp, $test);
$changed_to_deicmal_form = $test[1].".".$test[2];
echo "$changed_to_deicmal_form";
?>
Robert
-----Original Message-----
From: Christopher Allen [mailto:callen@driver8.org]
Sent: Thursday, January 18, 2001 11:35 AM
To: php
Subject: [PHP] decimal point movement...
Greetings!
I am looking for an efficeient way to assign a decimal to a number and store
the new number.
I wanto add a decimal point after the first 2 leading digitis..
while ( query runs)
{
$temp=007170;
$changed_to_deicmal_form; // would store .7170
}
Furthermore I was using printf to round up numbers...has anyone found a
different or better way?
Christopher C. M. Allen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net