reference/var/functions/is-scalar.xml
d816a0fad6c458d9515f697cc89e26ca9d8069f5
d816a0fad6c458d9515f697cc89e26ca9d8069f5
...
...
@@ -12,16 +12,14 @@
12
12
&reftitle.description;
13
13
<methodsynopsis>
14
14
<type>bool</type><methodname>is_scalar</methodname>
15
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
15
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
-
Finds whether the given variable is a scalar.
18
+
Finds whether an <link linkend="language.expressions">expression</link> is
19
+
evaluated as a scalar value.
19
20
</para>
20
21
<para>
21
-
Scalar variables are those containing an <type>integer</type>,
22
-
<type>float</type>, <type>string</type> or <type>boolean</type>.
23
-
Types <type>array</type>, <type>object</type> and <type>resource</type>
24
-
are not scalar.
22
+
See <link linkend="language.types.type-system.atomic.scalar">scalar types</link> for more information.
25
23
</para>
26
24
<note>
27
25
<para>
...
...
@@ -43,7 +41,7 @@
43
41
<para>
44
42
<variablelist>
45
43
<varlistentry>
46
-
<term><parameter>var</parameter></term>
44
+
<term><parameter>value</parameter></term>
47
45
<listitem>
48
46
<para>
49
47
The variable being evaluated.
...
...
@@ -57,7 +55,7 @@
57
55
<refsect1 role="returnvalues">
58
56
&reftitle.returnvalues;
59
57
<para>
60
-
Returns &true; if <parameter>var</parameter> is a scalar, &false;
58
+
Returns &true; if <parameter>value</parameter> is a scalar, &false;
61
59
otherwise.
62
60
</para>
63
61
</refsect1>
...
...
@@ -75,11 +73,12 @@
75
73
function show_var($var)
76
74
{
77
75
if (is_scalar($var)) {
78
-
echo $var;
76
+
echo $var, PHP_EOL;
79
77
} else {
80
78
var_dump($var);
81
79
}
82
80
}
81
+
83
82
$pi = 3.1416;
84
83
$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin");
85
84
...
...
@@ -123,7 +122,6 @@ array(3) {
123
122
</para>
124
123
</refsect1>
125
124
</refentry>
126
-
127
125
<!-- Keep this comment at the end of the file
128
126
Local variables:
129
127
mode: sgml
130
128