Initial docs for intdiv()

-- 
Patch by Pasindu (ppasindud@gmail.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@336562 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Peter Cowburn 2015-04-17 14:16:23 +00:00
parent 52b94bc52e
commit f940e90ad6
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.intdiv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>intdiv</refname>
<refpurpose>Integer division</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>integer</type><methodname>intdiv</methodname>
<methodparam><type>integer</type><parameter>numerator</parameter></methodparam>
<methodparam><type>integer</type><parameter>divisor</parameter></methodparam>
</methodsynopsis>
<para>
Returns the integer division of <parameter>numerator</parameter> by <parameter>divisor</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>numerator</parameter></term>
<listitem>
<para>
Number to be divide.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>divisor</parameter></term>
<listitem>
<para>
Number which divides the <parameter>numerator</parameter>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The integer division of <parameter>numerator</parameter> by <parameter>divisor</parameter>.
If <parameter>divisor</parameter> is zero, it throws an <constant>E_WARNING</constant> and returns &false;.
If the <parameter>numerator</parameter> is LONG_MIN (-<constant>PHP_INT_MAX</constant> - 1) and the
<parameter>divisor</parameter> is -1, it returns zero.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>intdiv</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(intdiv(3, 2));
var_dump(intdiv(-3, 2));
var_dump(intdiv(3, -2));
var_dump(intdiv(-3, -2));
var_dump(intdiv(PHP_INT_MAX, PHP_INT_MAX));
var_dump(intdiv(-PHP_INT_MAX - 1, -PHP_INT_MAX - 1));
var_dump(intdiv(-PHP_INT_MAX - 1, -1));
var_dump(intdiv(1, 0));
?>
]]>
</programlisting>
<screen>
<![CDATA[
int(1)
int(-1)
int(-1)
int(1)
int(1)
int(1)
int(0)
Warning: intdiv(): Division by zero in %s on line 9
bool(false)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -53,6 +53,7 @@
<function name='srand' from='PHP 4, PHP 5'/>
<function name='tan' from='PHP 4, PHP 5'/>
<function name='tanh' from='PHP 4 &gt;= 4.1.0, PHP 5'/>
<function name='intdiv' from='PHP 7'/>
</versions>
<!-- Keep this comment at the end of the file