PHP Gmp_import () function

PHP

Syntax:
GMP gmp_import (string $data, int $word_size, int $options) 
Parameters:The gmp_import() function takes three parameters as above and described below:
  • $data:This is one of the required parameters and contains a binary string to be imported.
  • $word_size:This is also a parameter to the gmp_import() function. It contains the number of bytes in each chunk of binary data. This parameter is mainly used in conjunction with the options parameter. The default value for this parameter is 1.
  • $options:this parameter has a default value GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
Returned value:the function returns the GMP number on success, otherwise it returns FALSE on error.The following programs illustrate the function gmp_import() in PHP:
Program 1:
// PHP code that implements gmp_import()
// function $number = gmp_import ( "" );  
// gmp_strval() returns
// string value of gmp number echo gmp_strval ( $number ). "" ;  
?>
Output:
0 
Program 2:
// PHP code that implements
// gmp_import() function $number = gmp_import ( "12" );  
// strval() returns a string // value of the gmp number echo gmp_strval ( $number ). "" ;  
?>
Output:
258 
Related Articles:
  • PHP | Gmp_com() function
  • PHP | Gmp_and() Function
  • PHP | gmp archives
Link: php.net/manual/en/function.gmp-import.php



Get Solution for free from DataCamp guru