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 Comment P priya_1998 Follow 0 Improve P priya_1998 Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-gmp Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like