I know this will not be noticeable at all but just for the sake of learning, is there any overhead of calling class methods over calling a class property like I show in the example below for the $router->controller and $router->action ? Please don’t flame me about premature optimization, just trying to learn more.
// Using Class property
$router = new Router($uri, $uri_route_map);
$router->dispatch($router->controller, $router->action);
// Using Class methods instead
$router = new Router($uri, $uri_route_map);
$router->dispatch($router->controller(), $router->action());
$router->controlleris accessing a class property, basically just reading a variable.$router->controller()is calling a function. Calling a function is bound to have more overhead than reading a variable, especially since the function itself will probably read a variable.