PHP | gmp_import() Function Last Updated : 25 Jun, 2018 Summarize Comments Improve Suggest changes Share 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 More infoAdvertise with us Next Article PHP | gmp_import() Function P priya_1998 Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-gmp Similar Reads PHP | gmp_or() Function The gmp_or() is an inbuilt function in PHP which is used to calculate the bitwise OR of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_or($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. Thes 2 min read PHP gmp_init() Function The gmp_init() function is an inbuilt function in PHP that is used to create a GMP number from different data types, including strings, integers, or other GMP objects. It's commonly used when you want to start performing arithmetic operations on large numbers without losing precision. Syntax: gmp_in 2 min read PHP | gmp_mul() Function The gmp_mul() function in PHP is an inbuilt function which is used to multiply two GMP numbers (GNU Multiple Precision: For large numbers). Syntax: GMP gmp_mul ( GMP $num1, GMP $num2 ) Parameters: This function accepts two GMP numbers. It is mandatory parameters as shown in the above syntax. These c 1 min read PHP gmp_lcm() Function The gmp_lcm() is an inbuilt function in PHP that is used to calculate the least common multiple (LCM) of two or more integers. Syntax: gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMPParameters: This function accepts two parameters that are described below. $num1: A GMP number resource repre 1 min read PHP | gmp_intval() Function The gmp_intval() is an inbuilt function in PHP which converts a GMP number to an integer. Here GMP refers to GNU Multiple Precision which is for large numbers.Syntax:Â Â int gmp_intval ( $num ) Parameters: The function accepts a single parameter $num which is a GMP number and returns its integer valu 2 min read Like