Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

get_class_methods

Description

The get_class_methods of Class / Object for PHP gets the class methods' names.

Syntax

get_class_methods(
    object|string $object_or_class
): array

Parameters

object_or_class

The class name or an object instance.

Return

Returns an array of method names defined for the class specified by object_or_class.

Examples

1 · object_or_class · class

<?

class myclass
{
    function myfunction1()
    {
    }
    function myfunction2()
    {
    }
}

$object_or_class = "myclass";

$return = get_class_methods($object_or_class);

print_r($return);

?>
Array
(
    [0] => myfunction1
    [1] => myfunction2
)

2 · object_or_class · object

<?

class myclass
{
    function myfunction1()
    {
    }
    function myfunction2()
    {
    }
}

$object_or_class = new myclass();

$return = get_class_methods($object_or_class);

print_r($return);

?>
Array
(
    [0] => myfunction1
    [1] => myfunction2
)
HomeMenu