PHP | gmp_import() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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: php <?php // php code implementing gmp_import() // function $number = gmp_import("\0"); // The gmp_strval() returns the // string value of the gmp number echo gmp_strval($number) . "\n"; ?> Output: 0 Program 2: php <?php // php code implementing the // gmp_import() function $number = gmp_import("\0\1\2"); // The strval() returns the string // value of the gmp number echo gmp_strval($number) . "\n"; ?> Output: 258 Related Articles: PHP | gmp_com() Function PHP | gmp_and() Function PHP | gmp archives Reference: php.net/manual/en/function.gmp-import.php Create Quiz Comment P priya_1998 Follow 0 Improve P priya_1998 Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-gmp Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like