<?php
str gmp_export ( GMP|int|string $num,
int $word_size = 1,
int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN )
where,
$num = The GMP number to be exported
$word_size = The number of bytes in each chunk of binary data
$flags = To control how the binary string will be exported
?>
RELATED FLAGS | |
CONTANT NAME | VALUE |
GMP_ROUND_ZERO | 0 |
GMP_ROUND_PLUSINF | 1 |
GMP_ROUND_MINUSINF | 2 |
GMP_MPIR_VERSION | 3.0.0 |
GMP_VERSION | 6.0.0 |
GMP_MSW_FIRST | 1 |
GMP_LSW_FIRST | 2 |
GMP_LITTLE_ENDIAN | 4 |
GMP_BIG_ENDIAN | 8 |
GMP_NATIVE_ENDIAN | 16 |
ed48 |
<?php
$b01 = '997656246614747892046622708740401';
$i01 = gmp_export($b01);
echo 'gmp_export( ' . $b01 . ' ) = ' . $i01;
?>
<?php
$bv02 = [ '997656246614747892046622708740401',
'977453065168906566222568282403121',
'997656246614747892047717925466161' ];
$wv02 = [ 1, 2, 7 ];
foreach($bv02 as $b02)
{
foreach($wv02 as $w02)
{
$i02 = gmp_export($b02 , $w02 );
echo 'gmp_export ' . $b02 . ', ' .
$w02 . ') =<br><br>= ' .
$i02 . '<br><br><br>';
}
}
?>
<?php
$bv03 = [ '44469170785662433440067810223148777773',
'60154957638466669228148190227381580833' ];
$wv03 = 1;
$op03 = [ GMP_LSW_FIRST,
GMP_MSW_FIRST,
GMP_LITTLE_ENDIAN,
GMP_NATIVE_ENDIAN,
GMP_BIG_ENDIAN ];
foreach($bv03 as $b03)
{
foreach($op03 as $o03)
{
$i03 = gmp_export($b03 , $wv03, $o03 );
echo 'gmp_export( ' . $b03 . ', ' .
$wv03 . ', ' .
$o03 . ') =<br><br>= ' .
$i03 . '<br><br><br>';
}
}
?>