1--TEST-- 2SPL: class_parents() and class_implements() 3--FILE-- 4<?php 5 6spl_autoload_register(function ($cname) { 7 var_dump($cname); 8}); 9 10class a{} 11class b extends a{} 12class c extends b{} 13class d{} 14var_dump(class_parents(new c), 15 class_parents("c"), 16 class_parents(new b), 17 class_parents("b"), 18 class_parents("d"), 19 class_parents("foo", 0), 20 class_parents("foo", 1) 21); 22 23interface iface1{} 24interface iface2{} 25class f implements iface1, iface2{} 26var_dump(class_implements(new a), 27 class_implements("a"), 28 class_implements("aaa"), 29 class_implements("bbb", 0) 30); 31 32?> 33--EXPECTF-- 34Warning: class_parents(): Class foo does not exist in %sspl_003.php on line %d 35string(3) "foo" 36 37Warning: class_parents(): Class foo does not exist and could not be loaded in %sspl_003.php on line %d 38array(2) { 39 ["b"]=> 40 string(1) "b" 41 ["a"]=> 42 string(1) "a" 43} 44array(2) { 45 ["b"]=> 46 string(1) "b" 47 ["a"]=> 48 string(1) "a" 49} 50array(1) { 51 ["a"]=> 52 string(1) "a" 53} 54array(1) { 55 ["a"]=> 56 string(1) "a" 57} 58array(0) { 59} 60bool(false) 61bool(false) 62string(3) "aaa" 63 64Warning: class_implements(): Class aaa does not exist and could not be loaded in %sspl_003.php on line %d 65 66Warning: class_implements(): Class bbb does not exist in %sspl_003.php on line %d 67array(0) { 68} 69array(0) { 70} 71bool(false) 72bool(false) 73