Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_import

Description

The gmp_import of GMP for PHP imports from a binary string.

Syntax

gmp_import(
    string $data,
    int $word_size = 1,
    int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN
): GMP

Parameters

data

The binary string being imported

word_size

Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.

flags

Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.

Return

Returns a GMP number.

Examples

1 · data

<?

$data = "data";

$return = gmp_import($data);

var_dump($return);
object(GMP)#1 (1) {
  ["num"]=>
  string(10) "1684108385"
}

2 · word_size

<?

$data = "data";
$word_size = 2;

$return = gmp_import($data, $word_size);

var_dump($return);
object(GMP)#1 (1) {
  ["num"]=>
  string(10) "1633968500"
}

3 · flags

<?

$data = "data";
$word_size = 2;
$flags = GMP_MSW_FIRST | GMP_BIG_ENDIAN;

$return = gmp_import($data, $word_size, $flags);

var_dump($return);
object(GMP)#1 (1) {
  ["num"]=>
  string(10) "1684108385"
}
HomeMenu