<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.gmp.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.gmp-scan1.php',
    1 => 'gmp_scan1',
    2 => 'Scan for 1',
  ),
  'up' => 
  array (
    0 => 'ref.gmp.php',
    1 => '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' => 'en',
    'path' => 'reference/gmp/functions/gmp-scan1.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gmp-scan1" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gmp_scan1</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gmp_scan1</span> &mdash; <span class="dc-title">Scan for 1</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.gmp-scan1-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gmp_scan1</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.gmp.php" class="type GMP">GMP</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$num1</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Scans <code class="parameter">num1</code>, starting with bit
   <code class="parameter">start</code>, towards more significant bits,
   until the first set bit is found.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.gmp-scan1-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">num1</code></dt>
     <dd>
      <p class="para">
       The number to scan.
      </p>
      <p class="para">
 <span class="classname"><a href="class.gmp.php" class="classname">GMP</a></span> 对象、<span class="type"><a href="language.types.integer.php" class="type int">int</a></span> 或 <span class="type"><a href="language.types.string.php" class="type string">string</a></span>，可以按照跟在 <span class="function"><a href="function.gmp-init.php" class="function">gmp_init()</a></span>
 中使用字符串并自动检测 base（即当 base 等于 0 时）相同的逻辑将其解释为数字。
</p> 
     </dd>
    
    
     <dt><code class="parameter">start</code></dt>
     <dd>
      <p class="para">
       The starting bit.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.gmp-scan1-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the index of the found bit, as an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
   If no set bit is found, -1 is returned.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gmp-scan1-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>gmp_scan1()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// "1" bit is found at position 3. index starts at 0<br /></span><span style="color: #0000BB">$s1 </span><span style="color: #007700">= </span><span style="color: #0000BB">gmp_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"01000"</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">gmp_scan1</span><span style="color: #007700">(</span><span style="color: #0000BB">$s1</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// "1" bit is found at position 9. index starts at 5<br /></span><span style="color: #0000BB">$s2 </span><span style="color: #007700">= </span><span style="color: #0000BB">gmp_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"01000001111"</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">gmp_scan1</span><span style="color: #007700">(</span><span style="color: #0000BB">$s2</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">3
9</pre>
</div>
    </div>
   </div>
  </p>
 </div>


</div><?php manual_footer($setup); ?>