With that syntax you are able to call methods and variables of a class dynamically without knowing their respective name (also see variable variable names in the docs).
/edit: updated the answer with a more sophisticated example, I hope this is easier to understand. Fixed the original code, this one should actually work.
Example:
<?php
class Router {
// respond
//
// just a simple method that checks wether
// we got a method for $route and if so calls
// it while forwarding $options to it
public function respond ($route, $options) {
// check if a method exists for this route
if (method_exists($this, 'route_'.$route) {
// call the method, without knowing which
// route is currently requested
print $this->{'route_'.$route}($options);
} else {
print '404, page not found :(';
}
}
// route_index
//
// a demo method for the "index" route
// expecting an array of options.
// options['name'] is required
public function route_index ($options) {
return 'Welcome home, '.$options['name'].'!';
}
}
// now create and call the router
$router = new Router();
$router->respond('foo');
// -> 404, because $router->route_foo() does not exist
$router->respond('index', array('name'=>'Klaus'));
// -> 'Welcome home Klaus!'
?>