<?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>int</type><methodname>intdiv</methodname>
   <methodparam><type>int</type><parameter>num1</parameter></methodparam>
   <methodparam><type>int</type><parameter>num2</parameter></methodparam>
  </methodsynopsis>
  <para>
   Returns the integer quotient of the division of <parameter>num1</parameter> by <parameter>num2</parameter>.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>num1</parameter></term>
    <listitem>
     <para>
      Number to be divided.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>num2</parameter></term>
    <listitem>
     <para>
      Number which divides the <parameter>num1</parameter>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The integer quotient of the division of <parameter>num1</parameter> by <parameter>num2</parameter>.
  </para>
 </refsect1>
 <refsect1 role="errors">
  &reftitle.errors;
  <para>
    If <parameter>num2</parameter> is <literal>0</literal>, a <classname>DivisionByZeroError</classname>
    exception is thrown. If the <parameter>num1</parameter> is <constant>PHP_INT_MIN</constant>
    and the <parameter>num2</parameter> is <literal>-1</literal>, then an
    <classname>ArithmeticError</classname> exception is thrown.
  </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_MIN, PHP_INT_MIN));
var_dump(intdiv(PHP_INT_MIN, -1));
var_dump(intdiv(1, 0));
?>
]]>
    </programlisting>
    <screen>
<![CDATA[
int(1)
int(-1)
int(-1)
int(1)
int(1)
int(1)

Fatal error: Uncaught ArithmeticError: Division of PHP_INT_MIN by -1 is not an integer in %s on line 8
Fatal error: Uncaught DivisionByZeroError: Division by zero in %s on line 9
]]>
    </screen>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><link linkend="language.operators.arithmetic"><literal>/</literal></link> - Floating-point division</member>
    <member><link linkend="language.operators.arithmetic"><literal>%</literal></link> - Integer modulus</member>
    <member><function>fmod</function> - Floating-point modulo</member>
   </simplelist>
  </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
-->
