Computer >> Computer tutorials >  >> Programming >> PHP

gmp_import() function in PHP


The gmp_import() function imports a GMP number from a binary string.

Syntax

GMP gmp_import (data, word_size, options)

Parameters

  • data: Binary string being imported.

  • word_size: The count of bytes in each chunk of binary data.

  • options: GMP_MSW_FIRST | GMP_NATIVE_ENDIAN are the default values.

Example

The gmp_import() function returns the GMP number.

Example

The following is an example:

<?php
   $res = gmp_import("\0\1\2");
   echo gmp_strval($res);
?>

Output

The following is the output:

258