mirror of
https://github.com/php/doc-ru.git
synced 2026-03-25 16:22:18 +01:00
126 lines
4.0 KiB
XML
126 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 0c9c2dd669fe9395eaa73d487fbd160f9057429a Maintainer: rjhdby Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.intdiv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<refnamediv>
|
||
<refname>intdiv</refname>
|
||
<refpurpose>Делит два числа без остатка</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>
|
||
Возвращает целочисленное частное деления числа <parameter>num1</parameter>
|
||
на число <parameter>num2</parameter>.
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>num1</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Делимое, число, которое нужно разделить.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>num2</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Делитель, число, на которое делится число <parameter>num1</parameter>.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</refsect1>
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Возвращает целое частное от деления числа <parameter>num1</parameter> на число <parameter>num2</parameter>.
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="errors">
|
||
&reftitle.errors;
|
||
<para>
|
||
Если число <parameter>num2</parameter> равно <literal>0</literal>, будет выброшено
|
||
исключение <classname>DivisionByZeroError</classname>.
|
||
Если число <parameter>num1</parameter> равно значению константы <constant>PHP_INT_MIN</constant>,
|
||
а число <parameter>num2</parameter> равно <literal>-1</literal>, будет выброшено
|
||
исключение <classname>ArithmeticError</classname>.
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования функции <function>intdiv</function></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> — Деление чисел с плавающей точкой</member>
|
||
<member><link linkend="language.operators.arithmetic"><literal>%</literal></link> — Целочисленный модуль</member>
|
||
<member><function>fmod</function> — Остаток в виде числа с плавающей точкой от деления по модулю</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
|
||
-->
|