Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 3244

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create GMP number</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.gmp-hamdist.html">gmp_hamdist</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.gmp-intval.html">gmp_intval</a></div>
 <div class="up"><a href="ref.gmp.html">GMP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.gmp-init" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gmp_init</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">gmp_init</span> &mdash; <span class="dc-title">Create GMP number</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.gmp-init-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>gmp_init</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$number</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$base</code><span class="initializer"> = 0</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Creates a GMP number from an integer or string. 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.gmp-init-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">number</code></em></span>
     <dd>

      <p class="para">
       An integer or a string. The string representation can be decimal, 
       hexadecimal or octal.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">base</code></em></span>
     <dd>

      <p class="para">
       The base.
      </p>
      <p class="para">
       The base may vary from 2 to 36. If base is 0 (default value), the
       actual base is determined from the leading characters: if the first
       two characters are <em>0x</em> or <em>0X</em>,
       hexadecimal is assumed, otherwise if the first character is &quot;0&quot;,
       octal is assumed, otherwise decimal is assumed.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.gmp-init-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   A GMP number <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gmp-init-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.3.2</td>
       <td>
        The <em><code class="parameter">base</code></em> was extended from 2 to 36, to
        2 to 62 and -2 to -36.
       </td>
      </tr>

      <tr>
       <td>4.1.0</td>
       <td>
        The optional <em><code class="parameter">base</code></em> parameter was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.gmp-init-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    To use the extended base introduced in PHP 5.3.2, then 
    PHP must be compiled against GMP 4.2.0 or greater.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gmp-init-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-3413">
    <p><strong>Example #1 Creating GMP number</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">gmp_init</span><span style="color: #007700">(</span><span style="color: #0000BB">123456</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">gmp_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"0xFFFFDEBACDFEDF7200"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.gmp-init-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    It is not necessary to call this function if you want to use
    integer or string in place of GMP number in GMP functions, like
     <span class="function"><a href="function.gmp-add.html" class="function">gmp_add()</a></span>. Function arguments are
    automatically converted to GMP numbers, if such conversion is
    possible and needed, using the same rules as
     <span class="function"><strong>gmp_init()</strong></span>.
   </p>
  </p></blockquote>
 </div>

 
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.gmp-hamdist.html">gmp_hamdist</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.gmp-intval.html">gmp_intval</a></div>
 <div class="up"><a href="ref.gmp.html">GMP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>