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";
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.