Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- ReflectionClass::hasMethod() --CREDITS-- Marc Veldman <[email protected]> #testf..
Decoded Output download
--TEST--
ReflectionClass::hasMethod()
--CREDITS--
Marc Veldman <[email protected]>
#testfest roosendaal on 2008-05-10
--FILE--
<?php
//New instance of class C - defined below
$rc = new ReflectionClass("C");
//Check if C has public method publicFoo
var_dump($rc->hasMethod('publicFoo'));
//Check if C has protected method protectedFoo
var_dump($rc->hasMethod('protectedFoo'));
//Check if C has private method privateFoo
var_dump($rc->hasMethod('privateFoo'));
//Check if C has static method staticFoo
var_dump($rc->hasMethod('staticFoo'));
//C should not have method bar
var_dump($rc->hasMethod('bar'));
//Method names are case insensitive
var_dump($rc->hasMethod('PUBLICfOO'));
Class C {
public function publicFoo()
{
return true;
}
protected function protectedFoo()
{
return true;
}
private function privateFoo()
{
return true;
}
static function staticFoo()
{
return true;
}
}
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
Did this file decode correctly?
Original Code
--TEST--
ReflectionClass::hasMethod()
--CREDITS--
Marc Veldman <[email protected]>
#testfest roosendaal on 2008-05-10
--FILE--
<?php
//New instance of class C - defined below
$rc = new ReflectionClass("C");
//Check if C has public method publicFoo
var_dump($rc->hasMethod('publicFoo'));
//Check if C has protected method protectedFoo
var_dump($rc->hasMethod('protectedFoo'));
//Check if C has private method privateFoo
var_dump($rc->hasMethod('privateFoo'));
//Check if C has static method staticFoo
var_dump($rc->hasMethod('staticFoo'));
//C should not have method bar
var_dump($rc->hasMethod('bar'));
//Method names are case insensitive
var_dump($rc->hasMethod('PUBLICfOO'));
Class C {
public function publicFoo()
{
return true;
}
protected function protectedFoo()
{
return true;
}
private function privateFoo()
{
return true;
}
static function staticFoo()
{
return true;
}
}
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
Function Calls
None |
Stats
MD5 | 60adda9f9dff7d020fcc1d505fe11ac6 |
Eval Count | 0 |
Decode Time | 79 ms |