I saw an example in a book recently that I don't fully understand and maybe someone can help clarify for me. The code in question is:
<?php
class Person {
function __get($property){
$method = "get{$property}";
if (method_exists($this, $method)){
return $this->$method();
}
}
function getName(){
return "bob";
}
}
$p = new Person();
echo $p->name;
?>
Which mostly makes sense to me, my only issue is this line:
$method = "get{$property}";
what are the brackets for and what do they do in this situation, I have never come across this. I am still learning, so this may be an easier question than I think. Thanks for you help!