Source Code : Accessing the Attributes of a Class by Using Functions

PHP Is Open Source Programming Language You Can Download and use It, You required xampp server and wamp server . You download From xampp server from https://www.apachefriends.org/download.html. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://php.net/. Click Here or search from google with Libraries Name you get jar file related it and also http://php.net/ is a official site

Accessing the Attributes of a Class by Using Functions

<?php
  class employee{
      var $emp_code;
      var $name;
      var $address;
      var $department;
      var $sex;
      var $date_of_birth;
      var $salary;
      function showsalary () {
         echo "Your salary is :",$this->salary," 
";
      }
  }
  $dave = new employee;
  $dave->emp_code="8";
  $dave->name="Dave";
  $dave->address="Apartment 1";
  $dave->department="Admin Development";
  $dave->sex="Male";
  $dave->salary="70";
  $dave->date_of_birth="15-09-1977";

  $dave->showsalary();
?>
           
       

Thank with us