Forum und email

bcadd

(PHP 4, PHP 5)

bcadd — Addition zweier Zahlen beliebiger Genauigkeit

Beschreibung

string bcadd ( string $left_operand , string $right_operand [, int $scale ] )

Addiert den left_operand (linken Operanden) zum right_operand (rechten Operanden).

Parameter Liste

left_operand

Der linke Operand in Stringform.

right_operand

Der rechte Operand in Stringform.

scale

This optional parameter is used to set the number of digits after the decimal place in the result. You can also set the global default scale for all functions by using bcscale().

Rückgabewerte

Die Summe beider Operanden in Stringform.

Beispiele

Example#1 bcadd()-Beispiel

<?php

$a 
'1.234';
$b '5';

echo 
bcadd($a$b);     // 6
echo bcadd($a$b4);  // 6.2340

?>

Siehe auch