reference/classobj/functions/is-a.xml
c558c3af38874a913c7515bbd49aaf2e689cbdd0
c558c3af38874a913c7515bbd49aaf2e689cbdd0
...
...
@@ -3,7 +3,7 @@
3
3
<refentry xml:id="function.is-a" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>is_a</refname>
6
-
<refpurpose>Checks if the object is of this class or has this class as one of its parents</refpurpose>
6
+
<refpurpose>Checks whether the object is of a given type or subtype</refpurpose>
7
7
</refnamediv>
8
8
<refsect1 role="description">
9
9
&reftitle.description;
...
...
@@ -14,8 +14,9 @@
14
14
<methodparam choice="opt"><type>bool</type><parameter>allow_string</parameter><initializer>&false;</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
-
Checks if the given <parameter>object_or_class</parameter> is of this class or has
18
-
this class as one of its parents.
17
+
Determines if the given <parameter>object_or_class</parameter> is the
18
+
<parameter>class</parameter> object type,
19
+
or has <parameter>class</parameter> as one of its supertypes.
19
20
</para>
20
21
</refsect1>
21
22
<refsect1 role="parameters">
...
...
@@ -34,7 +35,7 @@
34
35
<term><parameter>class</parameter></term>
35
36
<listitem>
36
37
<para>
37
-
The class name
38
+
The class or interface name
38
39
</para>
39
40
</listitem>
40
41
</varlistentry>
...
...
@@ -53,8 +54,9 @@
53
54
<refsect1 role="returnvalues">
54
55
&reftitle.returnvalues;
55
56
<para>
56
-
Returns &true; if the object is of this class or has this class as one of
57
-
its parents, &false; otherwise.
57
+
Returns &true; if <parameter>object_or_class</parameter> is the
58
+
<parameter>class</parameter> object type,
59
+
or has <parameter>class</parameter> as one of its supertypes, &false; otherwise.
58
60
</para>
59
61
</refsect1>
60
62
<refsect1 role="examples">
...
...
@@ -86,6 +88,15 @@ if (is_a($WF, 'WidgetFactory')) {
86
88
<programlisting role="php">
87
89
<![CDATA[
88
90
<?php
91
+
// define a class
92
+
class WidgetFactory
93
+
{
94
+
var $oink = 'moo';
95
+
}
96
+
97
+
// create a new object
98
+
$WF = new WidgetFactory();
99
+
89
100
if ($WF instanceof WidgetFactory) {
90
101
echo 'Yes, $WF is a WidgetFactory';
91
102
}
92
103