com doc/zh: 更新 is_int(): reference/ var/functions/is-int.xml
| From: | Bole Chen | Date: | Sat, 20 Feb 2021 08:45:38 +0000 |
| Subject: | com doc/zh: 更新 is_int(): reference/ var/functions/is-int.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-5979@lists.php.net to get a copy of this message | ||
Commit: eed26fe52d5d014fff40b63f8bfe155a3a610bfb
Author: 蒋文健 <jwjbjg@gmail.com> Sat, 20 Feb 2021 15:43:39 +0800
Committer: Bole Chen <avenger@php.net> Sat, 20 Feb 2021 16:45:38 +0800
Parents: be485e56d282e6a3a72994d171af3829d5ecae87
Branches: master
Link: http://git.php.net/?p=doc/zh.git;a=commitdiff;h=eed26fe52d5d014fff40b63f8bfe155a3a610bfb
Log:
更新 is_int()
Changed paths:
M reference/var/functions/is-int.xml
Diff:
diff --git a/reference/var/functions/is-int.xml b/reference/var/functions/is-int.xml
index bc3b8a45..602036cc 100644
--- a/reference/var/functions/is-int.xml
+++ b/reference/var/functions/is-int.xml
@@ -1,36 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- $Author$ -->
-<!-- EN-Revision: n/a Maintainer: nio Status: ready -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
- <refentry xml:id="function.is-int" xmlns="http://docbook.org/ns/docbook">
- <refnamediv>
- <refname>is_int</refname>
- <refpurpose>检测变量是否是整数</refpurpose>
- </refnamediv>
- <refsect1>
- <title>描述</title>
- <methodsynopsis>
- <type>bool</type><methodname>is_int</methodname>
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
- </methodsynopsis>
- <simpara>
- 如果 <parameter>var</parameter> 是 <type>integer</type> 则返回
&true;,否则返回 &false;。
- </simpara>
- <note>
- <para>
-
若想测试一个变量是否是数字或数字字符串(如表单输入,它们通常为字符串),必须使用
- <function>is_numeric</function>。
- </para>
- </note>
- <simpara>
- 参见
-
<function>is_bool</function>、<function>is_float</function>、<function>is_integer</function>、<function>is_numeric</function>、<function>is_string</function>、<function>is_array</function>
- 和 <function>is_object</function>。
- </simpara>
- </refsect1>
- </refentry>
+<!-- EN-Revision: 0c9c2dd669fe9395eaa73d487fbd160f9057429a Maintainer: nio Status: ready -->
+<refentry xml:id="function.is-int" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>is_int</refname>
+ <refpurpose>检测变量是否是整数</refpurpose>
+ </refnamediv>
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>is_int</methodname>
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ 检测变量的类型是否为整数(integer)。
+ </para>
+ <note>
+ <para>
+
若想检测变量是否是数字或数字字符串(如表单输入,它们通常为字符串),则必须使用
+ <function>is_numeric</function> 。
+ </para>
+ </note>
+ </refsect1>
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>value</parameter></term>
+ <listitem>
+ <para>
+ 要检测的变量。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 如果 <parameter>value</parameter> 是 <type>int</type> ,则返回
&true; ,否则返回 &false; 。
+ </para>
+ </refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>is_int</function> 示例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$values = array(23, "23", 23.5, "23.5", null, true, false);
+foreach ($values as $value) {
+ echo "is_int(";
+ var_export($value);
+ echo ") = ";
+ var_dump(is_int($value));
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+is_int(23) = bool(true)
+is_int('23') = bool(false)
+is_int(23.5) = bool(false)
+is_int('23.5') = bool(false)
+is_int(NULL) = bool(false)
+is_int(true) = bool(false)
+is_int(false) = bool(false)
+
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>is_bool</function></member>
+ <member><function>is_float</function></member>
+ <member><function>is_numeric</function></member>
+ <member><function>is_string</function></member>
+ <member><function>is_array</function></member>
+ <member><function>is_object</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml