Note that it is almost useless to put a integer higher than 6 maybe 7 in the scale parameter.
In some cases this might be needed. But for the simple souls, more than 4 is not required in most of the time.
bcsub
(PHP 4, PHP 5)
bcsub — 任意精度数値の減算を行う
説明
string bcsub
( string $left_operand
, string $right_operand
[, int $scale
] )
left_operand から right_operand を引きます。
パラメータ
- left_operand
-
左オペランドを表す文字列。
- right_operand
-
右オペランドを表す文字列。
- scale
-
このオプションパラメータを使用して、 結果の小数点以下の桁数を指定します。すべての関数で使用するデフォルトのスケールを定義するには bcscale() を使用します。
返り値
減算の結果を文字列で返します。
例
例1 bcsub() の例
<?php
$a = '1.234';
$b = '5';
echo bcsub($a, $b); // -3
echo bcsub($a, $b, 4); // -3.7660
?>
bcsub
info at DONOTSPAM dot ict-eagle dot eu
08-Aug-2009 04:43
08-Aug-2009 04:43
