summaryrefslogtreecommitdiff
path: root/ext/standard/tests/class_object/method_exists_basic_002.phpt
blob: c23bbee824f8de607c9c9d89263c7d1f9244c3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
method_exists() on internal classes
--FILE--
<?php
/* Prototype  : proto bool is_subclass_of(object object, string class_name)
 * Description: Returns true if the object has this class as one of its parents
 * Source code: Zend/zend_builtin_functions.c
 * Alias to functions:
 */

echo " ---(Internal classes, using string class name)---\n";
echo "Does exception::getmessage exist? ";
var_dump(method_exists("exception", "getmessage"));
echo "Does stdclass::nonexistent exist? ";
var_dump(method_exists("stdclass", "nonexistent"));

echo "\n ---(Internal classes, using class instance)---\n";
echo "Does exception::getmessage exist? ";
var_dump(method_exists(new exception, "getmessage"));
echo "Does stdclass::nonexistent exist? ";
var_dump(method_exists(new stdclass, "nonexistent"));

echo "Done";
?>
--EXPECTF--
 ---(Internal classes, using string class name)---
Does exception::getmessage exist? bool(true)
Does stdclass::nonexistent exist? bool(false)

 ---(Internal classes, using class instance)---
Does exception::getmessage exist? bool(true)
Does stdclass::nonexistent exist? bool(false)
Done