Daksh B
Daksh B

Reputation: 262

what does this $controller::Index() mean?

Looking at a router I find this $controller::Index();, what does this mean?

$router->map( 'GET', '/[a:controller]/', function($controller, $action = 'index') {
    if( method_exists( $controller, $action ))
        $controller::Index();
    else
        echo 'missing';
});

what does this $controller::Index() mean?

Upvotes: 0

Views: 173

Answers (1)

urfusion
urfusion

Reputation: 5501

$controller::Index();

call index function of controller. Where $controller has the name of controller class. So as per oops you are calling index function by using scope resolution operator (::).

Upvotes: 1

Related Questions