update page now

Voting

: min(four, two)?
(Example: nine)

The Note You're Voting On

tom at r dot je
11 years ago
ReflectionClass::getMethods() sorts the methods by class (lowest in the inheritance tree first) then by the order they are defined in the class definition:

<?php
class A {
    public function method1() {
        
    }
    
    public function method2() {
        
    }
}

class B extends A {

    public function method3() {

    }

    public function method4() {

    }
}

$class = new ReflectionClass('B');
print_r($class->getMethods());
?>

This will output:

Array
(
    [0] => ReflectionMethod Object
        (
            [name] => method3
            [class] => B
        )

    [1] => ReflectionMethod Object
        (
            [name] => method4
            [class] => B
        )

    [2] => ReflectionMethod Object
        (
            [name] => method1
            [class] => A
        )

    [3] => ReflectionMethod Object
        (
            [name] => method2
            [class] => A
        )

)

<< Back to user notes page

To Top