set property : Properties set : Class PHP Source Code


PHP Source Code » Class » Properties set »

 

set property



<?php
   class Staff
   {
      var $name;
      function __set($propName, $propValue)
      {
         $this->$propName = $propValue;
      }
   }

   $employee = new Staff();
   $employee->name = "Joe";
   $employee->title = "Programmer";
   
   echo "Name: ".$employee->name;
   echo "<br />";
   echo "Title: ".$employee->title;
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Class
» Properties set