1--TEST-- 2ReflectionClass::hasMethod() 3--CREDITS-- 4Marc Veldman <marc@ibuildings.nl> 5#testfest roosendaal on 2008-05-10 6--FILE-- 7<?php 8//New instance of class C - defined below 9$rc = new ReflectionClass("C"); 10 11//Check if C has public method publicFoo 12var_dump($rc->hasMethod('publicFoo')); 13 14//Check if C has protected method protectedFoo 15var_dump($rc->hasMethod('protectedFoo')); 16 17//Check if C has private method privateFoo 18var_dump($rc->hasMethod('privateFoo')); 19 20//Check if C has static method staticFoo 21var_dump($rc->hasMethod('staticFoo')); 22 23//C should not have method bar 24var_dump($rc->hasMethod('bar')); 25 26//Method names are case insensitive 27var_dump($rc->hasMethod('PUBLICfOO')); 28 29Class C { 30 public function publicFoo() 31 { 32 return true; 33 } 34 35 protected function protectedFoo() 36 { 37 return true; 38 } 39 40 private function privateFoo() 41 { 42 return true; 43 } 44 45 static function staticFoo() 46 { 47 return true; 48 } 49} 50?> 51--EXPECT-- 52bool(true) 53bool(true) 54bool(true) 55bool(true) 56bool(false) 57bool(true) 58