>> I have a script that outputs this:
>> 0.023884057998657
>>
>> What's the command to make it shrink down to this:
>> 0.023
>>
>> I thought it was eregi() something, but I forgot.  sorry
>
> It depends on what you need.
>
> If you want to round the number off to 3 decimal points use the round()
> function.  However if you don't want to round and instead just want to
> truncate the number, the number_format() function would be what you
> need.
>
> Sincerely,
>
> Craig Vincent
>

If speed is an issue, instead of using number_format for truncation use
substr. i.e: echo substr($var, 0, 5); to get 3 dp.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd



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

Reply via email to