array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'function.gmp-import.php', 1 => 'gmp_import', ), 'up' => array ( 0 => 'ref.gmp.php', 1 => 'Fonctions GMP', ), 'prev' => array ( 0 => 'function.gmp-hamdist.php', 1 => 'gmp_hamdist', ), 'next' => array ( 0 => 'function.gmp-init.php', 1 => 'gmp_init', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/gmp/functions/gmp-import.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.6.1, PHP 7, PHP 8)
gmp_import — Importation depuis une chaîne binaire
Importe un nombre GMP depuis une chaîne binaire.
data
La chaîne binaire à importer.
word_size
La valeur par défaut est 1. Le nombre d'octets dans chaque partie de données binaires. Principalement utilisé avec le paramètre options.
flags
La valeur par défaut est GMP_MSW_FIRST
| GMP_NATIVE_ENDIAN
.
Retourne un nombre GMP.
Version | Description |
---|---|
8.0.0 |
Cette fonction ne retourne plus false en cas d'échec.
|
Exemple #1 Exemple avec gmp_import()
<?php
$number = gmp_import("\0");
echo gmp_strval($number) . "\n";
$number = gmp_import("\0\1\2");
echo gmp_strval($number) . "\n";
?>
L'exemple ci-dessus va afficher :
0 258