1--TEST-- 2get_class() tests 3--FILE-- 4<?php 5 6class foo { 7 function bar () { 8 var_dump(get_class()); 9 } 10} 11 12class foo2 extends foo { 13} 14 15foo::bar(); 16foo2::bar(); 17 18$f1 = new foo; 19$f2 = new foo2; 20 21$f1->bar(); 22$f2->bar(); 23 24var_dump(get_class()); 25var_dump(get_class("qwerty")); 26 27var_dump(get_class($f1)); 28var_dump(get_class($f2)); 29 30echo "Done\n"; 31?> 32--EXPECTF-- 33Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d 34string(3) "foo" 35 36Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d 37string(3) "foo" 38string(3) "foo" 39string(3) "foo" 40 41Warning: get_class() called without object from outside a class in %s on line %d 42bool(false) 43 44Warning: get_class() expects parameter 1 to be object, string given in %s on line %d 45bool(false) 46string(3) "foo" 47string(4) "foo2" 48Done 49