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

gmp_export

Description

The gmp_export of GMP for PHP exports to a binary string.

Syntax

gmp_export(
    GMP|int|string $num,
    int $word_size = 1,
    int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN
): string

Parameters

num

The GMP number being exported

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 string.

Examples

1 · num · GMP

<?

$num = 1684108385;

$num = gmp_init($num);

$return = gmp_export($num);

echo $return;
data

2 · num · int

<?

$num = 1684108385;

$return = gmp_export($num);

echo $return;
data

3 · num · string

<?

$num = "1684108385";

$return = gmp_export($num);

echo $return;
data

4 · word_size

<?

$num = "1633968500";
$word_size = 2;

$return = gmp_export($num, $word_size);

echo $return;
data

5 · flags

<?

$num = "1684108385";
$word_size = 2;
$flags = GMP_MSW_FIRST | GMP_BIG_ENDIAN;

$return = gmp_export($num, $word_size, $flags);

echo $return;
data