reference/var/functions/is-int.xml
0c9c2dd669fe9395eaa73d487fbd160f9057429a
...
...
@@ -1,49 +1,49 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id="function.is-int" xmlns="http://docbook.org/ns/docbook">
4
-
<refnamediv>
5
-
<refname>is_int</refname>
6
-
<refpurpose>Find whether the type of a variable is integer</refpurpose>
7
-
</refnamediv>
8
-
<refsect1 role="description">
9
-
&reftitle.description;
10
-
<methodsynopsis>
11
-
<type>bool</type><methodname>is_int</methodname>
12
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
13
-
</methodsynopsis>
14
-
<para>
15
-
Finds whether the type of the given variable is integer.
16
-
</para>
17
-
<note>
18
-
<para>
19
-
To test if a variable is a number or a numeric string (such as form
20
-
input, which is always a string), you must use
21
-
<function>is_numeric</function>.
22
-
</para>
23
-
</note>
24
-
</refsect1>
25
-
<refsect1 role="parameters">
26
-
&reftitle.parameters;
27
-
<para>
28
-
<variablelist>
29
-
<varlistentry>
30
-
<term><parameter>var</parameter></term>
31
-
<listitem>
32
-
<para>
33
-
The variable being evaluated.
34
-
</para>
35
-
</listitem>
36
-
</varlistentry>
37
-
</variablelist>
38
-
</para>
39
-
</refsect1>
40
-
<refsect1 role="returnvalues">
41
-
&reftitle.returnvalues;
42
-
<para>
43
-
Returns &true; if <parameter>var</parameter> is an <type>integer</type>,
44
-
&false; otherwise.
45
-
</para>
46
-
</refsect1>
3
+
<refentry xml:id="function.is-int" xmlns="http://docbook.org/ns/docbook">
4
+
<refnamediv>
5
+
<refname>is_int</refname>
6
+
<refpurpose>Find whether the type of a variable is integer</refpurpose>
7
+
</refnamediv>
8
+
<refsect1 role="description">
9
+
&reftitle.description;
10
+
<methodsynopsis>
11
+
<type>bool</type><methodname>is_int</methodname>
12
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
13
+
</methodsynopsis>
14
+
<para>
15
+
Finds whether the type of the given variable is integer.
16
+
</para>
17
+
<note>
18
+
<para>
19
+
To test if a variable is a number or a numeric string (such as form
20
+
input, which is always a string), you must use
21
+
<function>is_numeric</function>.
22
+
</para>
23
+
</note>
24
+
</refsect1>
25
+
<refsect1 role="parameters">
26
+
&reftitle.parameters;
27
+
<para>
28
+
<variablelist>
29
+
<varlistentry>
30
+
<term><parameter>value</parameter></term>
31
+
<listitem>
32
+
<para>
33
+
The variable being evaluated.
34
+
</para>
35
+
</listitem>
36
+
</varlistentry>
37
+
</variablelist>
38
+
</para>
39
+
</refsect1>
40
+
<refsect1 role="returnvalues">
41
+
&reftitle.returnvalues;
42
+
<para>
43
+
Returns &true; if <parameter>value</parameter> is an <type>int</type>,
44
+
&false; otherwise.
45
+
</para>
46
+
</refsect1>
47
47

48
48
<refsect1 role="examples">
49
49
&reftitle.examples;
...
...
@@ -53,26 +53,27 @@
53
53
<programlisting role="php">
54
54
<![CDATA[
55
55
<?php
56
-
if (is_int(23)) {
57
-
echo "is integer\n";
58
-
} else {
59
-
echo "is not an integer\n";
56
+
$values = array(23, "23", 23.5, "23.5", null, true, false);
57
+
foreach ($values as $value) {
58
+
echo "is_int(";
59
+
var_export($value);
60
+
echo ") = ";
61
+
var_dump(is_int($value));
60
62
}
61
-
var_dump(is_int(23));
62
-
var_dump(is_int("23"));
63
-
var_dump(is_int(23.5));
64
-
var_dump(is_int(true));
65
63
?>
66
64
]]>
67
65
</programlisting>
68
66
&example.outputs;
69
67
<screen>
70
68
<![CDATA[
71
-
is integer
72
-
bool(true)
73
-
bool(false)
74
-
bool(false)
75
-
bool(false)
69
+
is_int(23) = bool(true)
70
+
is_int('23') = bool(false)
71
+
is_int(23.5) = bool(false)
72
+
is_int('23.5') = bool(false)
73
+
is_int(NULL) = bool(false)
74
+
is_int(true) = bool(false)
75
+
is_int(false) = bool(false)
76
+

76
77
]]>
77
78
</screen>
78
79
</example>
...
...
@@ -80,21 +81,20 @@ bool(false)
80
81
</refsect1>
81
82

82
83

83
-
<refsect1 role="seealso">
84
-
&reftitle.seealso;
85
-
<para>
86
-
<simplelist>
87
-
<member><function>is_bool</function></member>
88
-
<member><function>is_float</function></member>
89
-
<member><function>is_numeric</function></member>
90
-
<member><function>is_string</function></member>
91
-
<member><function>is_array</function></member>
92
-
<member><function>is_object</function></member>
93
-
</simplelist>
94
-
</para>
95
-
</refsect1>
96
-
</refentry>
97
-

84
+
<refsect1 role="seealso">
85
+
&reftitle.seealso;
86
+
<para>
87
+
<simplelist>
88
+
<member><function>is_bool</function></member>
89
+
<member><function>is_float</function></member>
90
+
<member><function>is_numeric</function></member>
91
+
<member><function>is_string</function></member>
92
+
<member><function>is_array</function></member>
93
+
<member><function>is_object</function></member>
94
+
</simplelist>
95
+
</para>
96
+
</refsect1>
97
+
</refentry>
98
98
<!-- Keep this comment at the end of the file
99
99
Local variables:
100
100
mode: sgml
101
101