Re: Math_UnitConvert
| From: | keith at uglyslug dot com | Date: | Mon, 17 Apr 2006 13:06:43 +0000 |
| Subject: | Re: Math_UnitConvert | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-42264@lists.php.net to get a copy of this message | ||
Thats a nice idea except... there are already over 100 units, plus 20 prefixes for each unit... that
means *at least* 2,000 constants... :-)
- Keith
Markus Tacker wrote ..
> The proposal [1] seems like a good idea but I'd like to see a more
> strict API which is
> less prone for user errors.
>
> So instead of
>
> $converter->convert("15 miles", "kilometers")
>
> you should use constants for the units
>
> $converter->convert(15, MATH_UNITCONVERT_MILES, MATH_UNITCONVERT_KILOMETERS);
>
> [1] http://pear.php.net/pepr/pepr-proposal-show.php?id=391
>
> --
> mit freundlichen GrüÃen email ~ m@tacker.org
> Markus Tacker url ~ http://m.tacker.org/
> icq ~ 91709561