File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
reference/reflection/reflectionclass Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 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 >
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?>
You can’t perform that action at this time.
0 commit comments