In the second example $name is interpreted as the value that's in $name, so if you put in 'cheese' it would try to bring back the value of
$obj->__get('cheese');
returns $this->cheese,
If you didn't put in the $ then
$obj->__get('cheese')
would return $this->name;
And similarly if there were not $ in the __set function
__set($name, $value)
{
$this->name = $value;
}
Would always set the property name, not whatever you were passing, so
$obj->set('sugar');
$obj->set('puffs');
Would always set $obj->name; While running it with the $ creates the properties sugar and puffs within the object.
Hope that's not too much gobbledygook.