PHP | gmp_import() Function Last Updated : 25 Jun, 2018 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 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 PHP | gmp_hamdist() Function The gmp_hamdist() is a built-in function in PHP which is used to find the hamming distance between two GMP numbers (GNU Multiple Precision : For large numbers). Hamming distance between two numbers is defined as number of mis-matching bits in their binary representation. Syntax: gmp_hamdist ( $num1, 2 min read PHP | gmp_gcd() Function The gmp_gcd() is an in built function in PHP which is used to calculate the GCD of 2 GMP numbers (GNU Multiple Precision : For large numbers). Syntax: gmp_gcd ( $num1, $num2 ) Parameters: This function accepts two GMP numbers $num1 and $num2 as parameters. This function calculates the GCD of these t 1 min read PHP | gmp_neg() Function The gmp_neg() function is an in-built function in PHP which returns the negative of a GMP number (GNU Multiple Precision). Syntax : gmp_neg( $num ) Parameters : The function accepts only one mandatory parameter $num which can be either a GMP number resource in PHP 5.5 or a GMP object in PHP version 1 min read PHP | gd_info() Function The gd_info() function is an inbuilt function in PHP which is used to retrieve the information about the currently installed GD library. This function returns the information about the version and capabilities of the installed GD library. Syntax: array gd_info( void ) Parameters: This function does 2 min read PHP | gmp_nextprime() Function The gmp_nextprime() is an inbuilt function in PHP which is used to calculate the prime number just greater than a given GMP number(GNU Multiple Precision : For large numbers). Syntax: gmp_nextprime($num) Parameters: This function accepts a GMP number $num as a mandatory parameter as shown in the abo 2 min read Like