PHP: gmp_add - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

gmp_and gmp_abs

Last updated: Sat, 27 Jan 2007

view this page in

# gmp_add

(PHP 4 >= 4.0.4, PHP 5)

gmp_add -- Add numbers

## Description

resource gmp_add ( resource a, resource b )

Add two GMP numbers. The result will be a GMP number representing the sum of the arguments.

Пример 1. gmp_add() example

`<?php $sum = gmp_add("123456789012345", "76543210987655"); echo gmp_strval($sum) . "\n"; ?>`

The printout of the above program will be:

    200000000000000

add a note User Contributed Notes
gmp_add
charlie at oblivion dot cz
18-Feb-2007 04:54
`gmp_* functions don't accept strings with a leading '+':
<?php
echo gmp_strval(gmp_init('+42')); #0
echo gmp_strval(gmp_add('42', '+42')); #42
echo bcadd('+42', '+42'); #84
?>`
add a note
gmp_and gmp_abs

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST