What does t开发者_高级运维he brakets mean and where to read more
return $container->{$resource};
The brackets are to make use of variable variables. It makes it easier to distinguish between:
// gets the value of the "resource" member from the container object
$container->resource;
and
// gets the value of the "foo" member from the container object
$resource = 'foo';
$container->$resource;
You can read more here: http://php.net/manual/en/language.variables.variable.php
Two possibilities:
variable variable.
$resource = "score"; // set the name dynamically
return $container->{$resource}; // same as return $container->score;
typo / beginner mistake
The programmer meant to type:
return $container->resource; // returns resource public member variable
精彩评论