Use public properties directly
<?php class Employee { public $title = "name"; public $mainName = "main name"; public $firstName = "first name"; } $product1 = new Employee(); $product1->title = "title"; $product1->mainName = "A"; $product1->firstName = "B"; print "author: {$product1->firstName} " . "{$product1->mainName}\n"; ?>