reference/var/functions/is-string.xml
0c9c2dd669fe9395eaa73d487fbd160f9057429a
...
...
@@ -9,10 +9,10 @@
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
11
<type>bool</type><methodname>is_string</methodname>
12
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
12
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
13
13
</methodsynopsis>
14
14
<para>
15
-
Finds whether the type given variable is string.
15
+
Finds whether the type of the given variable is string.
16
16
</para>
17
17
</refsect1>
18
18
<refsect1 role="parameters">
...
...
@@ -20,7 +20,7 @@
20
20
<para>
21
21
<variablelist>
22
22
<varlistentry>
23
-
<term><parameter>var</parameter></term>
23
+
<term><parameter>value</parameter></term>
24
24
<listitem>
25
25
<para>
26
26
The variable being evaluated.
...
...
@@ -33,7 +33,7 @@
33
33
<refsect1 role="returnvalues">
34
34
&reftitle.returnvalues;
35
35
<para>
36
-
Returns &true; if <parameter>var</parameter> is of type <type>string</type>,
36
+
Returns &true; if <parameter>value</parameter> is of type <type>string</type>,
37
37
&false; otherwise.
38
38
</para>
39
39
</refsect1>
...
...
@@ -45,26 +45,32 @@
45
45
<programlisting role="php">
46
46
<![CDATA[
47
47
<?php
48
-
if (is_string("23")) {
49
-
echo "is string\n";
50
-
} else {
51
-
echo "is not an string\n";
48
+
$values = array(false, true, null, 'abc', '23', 23, '23.5', 23.5, '', ' ', '0', 0);
49
+
foreach ($values as $value) {
50
+
echo "is_string(";
51
+
var_export($value);
52
+
echo ") = ";
53
+
echo var_dump(is_string($value));
52
54
}
53
-
var_dump(is_string('abc'));
54
-
var_dump(is_string("23"));
55
-
var_dump(is_string(23.5));
56
-
var_dump(is_string(true));
57
55
?>
58
56
]]>
59
57
</programlisting>
60
58
&example.outputs;
61
59
<screen>
62
60
<![CDATA[
63
-
is string
64
-
bool(true)
65
-
bool(true)
66
-
bool(false)
67
-
bool(false)
61
+
is_string(false) = bool(false)
62
+
is_string(true) = bool(false)
63
+
is_string(NULL) = bool(false)
64
+
is_string('abc') = bool(true)
65
+
is_string('23') = bool(true)
66
+
is_string(23) = bool(false)
67
+
is_string('23.5') = bool(true)
68
+
is_string(23.5) = bool(false)
69
+
is_string('') = bool(true)
70
+
is_string(' ') = bool(true)
71
+
is_string('0') = bool(true)
72
+
is_string(0) = bool(false)
73
+

68
74
]]>
69
75
</screen>
70
76
</example>
...
...
@@ -84,7 +90,6 @@ bool(false)
84
90
</para>
85
91
</refsect1>
86
92
</refentry>
87
-

88
93
<!-- Keep this comment at the end of the file
89
94
Local variables:
90
95
mode: sgml
91
96