mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Add example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@37167 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fc50dd8126
commit
119c75f8c3
1 changed files with 19 additions and 0 deletions
|
@ -33,6 +33,25 @@
|
|||
every function that expects GMP number. See also
|
||||
<function>gmp_init</function> function.
|
||||
</para></note>
|
||||
<para>
|
||||
<example>
|
||||
<title>Factorial function using GMP</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
function fact($x) {
|
||||
if($x <= 1)
|
||||
return 1;
|
||||
else
|
||||
return gmp_mul($x,fact($x-1));
|
||||
}
|
||||
|
||||
print gmp_strval(fact(1000))."\n";
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
This will calculate factiorial of 1000 (pretty big number)
|
||||
very fast.
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.gmp-init">
|
||||
|
|
Loading…
Reference in a new issue