Use public properties directly : public : Class PHP Source Code


PHP Source Code » Class » public »

 

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

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Class
» public