Skip to content

Commit 5ebff06

Browse files
committed
isinstance.xml Make the example workable and semantic
php/doc-en@eb55709
1 parent 6296d37 commit 5ebff06

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

reference/reflection/reflectionclass/isinstance.xml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 84f25609071c1da9110a54776d0eda3d3709cacb Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: eb557099ed1ddbc49c941f868d896991190b14f8 Maintainer: takagi Status: ready -->
44

55
<refentry xml:id="reflectionclass.isinstance" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -51,20 +51,24 @@
5151
<programlisting role="php">
5252
<![CDATA[
5353
<?php
54-
// 使用例
55-
$class = new ReflectionClass('Foo');
5654
57-
if ($class->isInstance($arg)) {
58-
echo "Yes";
55+
class Foo {}
56+
57+
$object = new Foo();
58+
59+
$reflection = new ReflectionClass('Foo');
60+
61+
if ($reflection->isInstance($object)) {
62+
echo "Yes\n";
5963
}
6064
6165
// これも同じ意味です
62-
if ($arg instanceof Foo) {
63-
echo "Yes";
66+
if ($object instanceof Foo) {
67+
echo "Yes\n";
6468
}
6569
6670
// これも同じ意味です
67-
if (is_a($arg, 'Foo')) {
71+
if (is_a($object, 'Foo')) {
6872
echo "Yes";
6973
}
7074
?>

0 commit comments

Comments
 (0)