VOOZH about

URL: https://www.geeksforgeeks.org/php/php-gmp_import-function/

⇱ PHP | gmp_import() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | gmp_import() Function

Last Updated : 11 Jul, 2025
The gmp_import() function is an inbuilt function in php which imports a GMP number(GNU Multiple Precision: For large numbers) from a binary string. Syntax:
GMP gmp_import ( string $data, int $word_size, int $options )
Parameters: The gmp_import() function accepts three parameters as mentioned above and described below:
  • $data: It is one of the required parameters, contains the binary string which is supposed to be imported.
  • $word_size: This is also a parameter of the gmp_import() function. It contains the number of bytes in each chunk of binary data. This parameter is mainly used simultaneously with the options parameter. The default value of this parameter is 1.
  • $options: This parameter has default value of GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
Return Value: The function returns a GMP number on success otherwise returns FALSE on failure. Below programs illustrate the gmp_import() function in PHP: Program 1: Output:
 0
Program 2: Output:
 258
Related Articles: Reference: php.net/manual/en/function.gmp-import.php
Comment
Article Tags: