array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'function.gmp-scan1.php', 1 => 'gmp_scan1', ), 'up' => array ( 0 => 'ref.gmp.php', 1 => 'Fonctions GMP', ), 'prev' => array ( 0 => 'function.gmp-scan0.php', 1 => 'gmp_scan0', ), 'next' => array ( 0 => 'function.gmp-setbit.php', 1 => 'gmp_setbit', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/gmp/functions/gmp-scan1.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp_scan1 — Recherche 1
Recherche dans num1
,
en commençant à la position start
,
vers les bits de poids lourd, jusqu'à ce qu'elle rencontre
un bit à 1.
num1
Le nombre à analyser.
Un objet GMP, un entier, ou une chaîne de caractères numérique.
start
Le bit de départ.
Retourne l'index du bit trouvé, sous la forme d'un entier. Si aucun bit n'est trouvé, -1 sera retourné.
Exemple #1 Exemple avec gmp_scan1()
<?php
// "1" bit est trouvé à la position 3. l'index commence à 0
$s1 = gmp_init("01000", 2);
echo gmp_scan1($s1, 0) . "\n";
// "1" bit est trouvé à la position 9. l'index commence à 5
$s2 = gmp_init("01000001111", 2);
echo gmp_scan1($s2, 5) . "\n";
?>
L'exemple ci-dessus va afficher :
3 9