1--TEST-- 2ReflectionObject::isInstance() - basic function test 3--FILE-- 4<?php 5class A {} 6class B extends A {} 7class X {} 8 9$classes = array("A", "B", "X"); 10 11$instances = array( "myA" => new A, 12 "myB" => new B, 13 "myX" => new X ); 14 15foreach ($classes as $class) { 16 $ro = new ReflectionObject(new $class); 17 foreach ($instances as $name => $instance) { 18 echo "is $name a $class? "; 19 var_dump($ro->isInstance($instance)); 20 } 21} 22 23?> 24--EXPECT-- 25is myA a A? bool(true) 26is myB a A? bool(true) 27is myX a A? bool(false) 28is myA a B? bool(false) 29is myB a B? bool(true) 30is myX a B? bool(false) 31is myA a X? bool(false) 32is myB a X? bool(false) 33is myX a X? bool(true) 34