reference/var/functions/is-resource.xml
77887dc8e5ee9e840f0ed440431c70259fcc5661
...
...
@@ -13,10 +13,10 @@
13
13
&reftitle.description;
14
14
<methodsynopsis>
15
15
<type>bool</type><methodname>is_resource</methodname>
16
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
16
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
17
17
</methodsynopsis>
18
18
<para>
19
-
Finds whether the given variable is a resource.
19
+
Finds whether the given variable is a <type>resource</type>.
20
20
</para>
21
21
</refsect1>
22
22

...
...
@@ -25,7 +25,7 @@
25
25
<para>
26
26
<variablelist>
27
27
<varlistentry>
28
-
<term><parameter>var</parameter></term>
28
+
<term><parameter>value</parameter></term>
29
29
<listitem>
30
30
<para>
31
31
The variable being evaluated.
...
...
@@ -39,7 +39,7 @@
39
39
<refsect1 role="returnvalues">
40
40
&reftitle.returnvalues;
41
41
<para>
42
-
Returns &true; if <parameter>var</parameter> is a <type>resource</type>,
42
+
Returns &true; if <parameter>value</parameter> is a <type>resource</type>,
43
43
&false; otherwise.
44
44
</para>
45
45
</refsect1>
...
...
@@ -53,18 +53,33 @@
53
53
<![CDATA[
54
54
<?php
55
55

56
-
$db_link = @mysql_connect('localhost', 'mysql_user', 'mysql_pass');
57
-
if (!is_resource($db_link)) {
58
-
die('Can\'t connect : ' . mysql_error());
56
+
$handle = fopen("php://stdout", "w");
57
+
if (is_resource($handle)) {
58
+
echo '$handle is a resource';
59
59
}
60
60

61
61
?>
62
62
]]>
63
63
</programlisting>
64
+
&example.outputs;
65
+
<screen role="php">
66
+
<![CDATA[
67
+
$handle is a resource
68
+
]]>
69
+
</screen>
64
70
</example>
65
71
</para>
66
72
</refsect1>
67
73
74
+
<refsect1 role="notes">
75
+
&reftitle.notes;
76
+
<note>
77
+
<para>
78
+
<function>is_resource</function> is not a strict type-checking method: it will return &false; if <parameter>value</parameter> is a resource variable that has been closed.
79
+
</para>
80
+
</note>
81
+
</refsect1>
82
+

68
83
<refsect1 role="seealso">
69
84
&reftitle.seealso;
70
85
<para>
...
...
@@ -75,7 +90,6 @@ if (!is_resource($db_link)) {
75
90
</para>
76
91
</refsect1>
77
92
</refentry>
78
-

79
93
<!-- Keep this comment at the end of the file
80
94
Local variables:
81
95
mode: sgml
82
96