gmp_init
gmp_init
Create GMP number
GMP **gmp_init** $num int $base
Creates a GMP number from an integer or string.
numAn integer or a string. The string representation can be decimal,
hexadecimal, octal, or binary.
base
The base to use for converting a representation.
string
An explicit base can be between and .
For bases up to , case is ignored;
upper-case and lower-case letters have the same value.
For bases to ,
upper-case letter represent the values to
and lower-case letter represent the values
to .
`2``62``36``37``62``10``35``36``61`
If is then the actual
base is determined from the leading characters of .
If the first two characters are or ,
the string is interpreted as a hexadecimal integer.
If the first two characters are or ,
the string is interpreted as a binary integer.
If the first two characters are or ,
the string is interpreted as an octal integer.
Moreover, if the first character is the string
is also interpreted as an octal integer.
In all other cases, the string is interpreted as a decimal integer.
`base``0``num``0x``0X``0b``0B``0o``0o``0`
gmp.return
Voorbeeld: Creating GMP number
<?php
$a = gmp_init(123456);
$b = gmp_init("0xFFFFDEBACDFEDF7200");
?>
Opmerking: > It is not necessary to call this function in order to use integers or strings in place of GMP numbers in GMP functions (such as with ). Function arguments are automatically converted to GMP numbers, if such conversion is possible and needed, using the same rules as .
gmp_add``gmp_init
GMP::__construct