PHP 8.5.0 Alpha 4 available for testing

Voting

: one plus four?
(Example: nine)

The Note You're Voting On

rahul dot anand77 at gmail dot com
9 years ago
To check if a method declared in a class is static or not, you can us following code. PHP5 has a Reflection Class, which is very helpful.

try {
$method = new ReflectionMethod( 'className::methodName );
if ( $method->isStatic() )
{
// Method is static.
}
}
catch ( ReflectionException $e )
{
// method does not exist
echo $e->getMessage();
}

*You can read more about Reflection class on http://php.net/manual/en/class.reflectionclass.php

<< Back to user notes page

To Top