On Tue, Mar 6, 2012 at 22:05, Michael Morris <[email protected]> wrote:
> I do use it. It's a pain in the ass to read because you have to LISP
> nest all the operations. You can't tell me this is easy or intuitive
> to read...
>
> bcadd( bcsub( $bill['penalty'], $bill['rounding'], 2),bcmul(
> $bill['taxdue'], bcmul( $penalty, $monthsAhead, 2 ), 2 ), 2 )
>
> Compared to
>
> $bill['penalty'] - $bill['rounding'] + $bill['taxdue'] * $penalty *
> $monthsAhead;
>
> You can do it, but it's eye bleeding.
I agree with you, how about having the bcmath extension support a more
general (and even better, non-BC-breaking) function supporting the
order of math operations (and maybe even math functions)... Something
like a bc(string $operations [, int $scale = 2])
Supporting passing: bc("(29.99 + $a) * $b - pow(10, $c) / 2");
Came across something like that in the manual: http://php.net/ref.bc#107014
How's that for a quick 'n dirty idea to solve this issue?
~ Daniel Macedo
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php