The gmp_export()
function in PHP converts the number to a binary string.
gmp_export(GMP|int|string $num, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
num
: This is a GMP object, integer, or a string value to convert to a binary string.word_size
: This parameter indicates the number of bytes in a chunk of binary data. The default value is 1
. This is dependent on the flags
parameter.flags
: The default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN
.The method returns a binary string.
<?php$bin = gmp_export(12343);echo "gmp_export(12343) - ".$bin;?>
gmp_init()
method.