1--TEST-- 2method_exists() on internal classes 3--FILE-- 4<?php 5/* Prototype : proto bool is_subclass_of(object object, string class_name) 6 * Description: Returns true if the object has this class as one of its parents 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10 11echo " ---(Internal classes, using string class name)---\n"; 12echo "Does exception::getmessage exist? "; 13var_dump(method_exists("exception", "getmessage")); 14echo "Does stdclass::nonexistent exist? "; 15var_dump(method_exists("stdclass", "nonexistent")); 16 17echo "\n ---(Internal classes, using class instance)---\n"; 18echo "Does exception::getmessage exist? "; 19var_dump(method_exists(new exception, "getmessage")); 20echo "Does stdclass::nonexistent exist? "; 21var_dump(method_exists(new stdclass, "nonexistent")); 22 23echo "Done"; 24?> 25--EXPECTF-- 26 ---(Internal classes, using string class name)--- 27Does exception::getmessage exist? bool(true) 28Does stdclass::nonexistent exist? bool(false) 29 30 ---(Internal classes, using class instance)--- 31Does exception::getmessage exist? bool(true) 32Does stdclass::nonexistent exist? bool(false) 33Done