RE: [PHP] Move Decimal Point
| From: | John W. Holmes | Date: | Wed, 11 Dec 2002 17:54:51 +0000 |
| Subject: | RE: [PHP] Move Decimal Point | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127856@lists.php.net to get a copy of this message | ||
>I have a question. How would you move the decimal left or right,
depending on if the
>number a user enters is negative or not, and then move it that many
spaces? If
>needed, it would add zeros.
Hmm. Trying to remember what grade I learned this in. You multiply by 10
to move it right, divide by 10 to move it left.
>One other question. How would I find the first 0 of a repeating zero.
Like 204,000.
>How would you find the 0 in the 4th column.
Treat it as a string and look for the first set of double zeros.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/