Some class syntax I don't understand

I saw this in some sample code:

print "author: {$product1->getProducer()}";

But I do not understand what the {} are doing here. Similarly,

function getProducer()
   return "{$this->produceName1}" . "{$this->productName2}";

I do not (again) understand what the curly braces are doing. What is it that they are setting off and why are they required here? I don’t know the general rules for curly braces in this situation.

Has nothing to do with classes. Its just a general syntax convention for PHP.

That second example is pointlessly over-complicated.

return $this->produceName1 .$this->productName2;

PHP expands scalar variables in double quoted strings.

Use the {} to optionally delimit them to a) maybe make it easier to read? b) delineate to PHP exactly where one variable ends and string starts.

Silly example.

$var = "gold"
$varn = "nothing";

// so this
echo "Theres $varn them thar hills";

// outputs different to this
echo "Theres {$var}n them thar hills";

Many thanks for the link and sample explanation.