Use poroperty set : Properties set « Class « PHP






Use poroperty set


<?php
   class Staff
   {
      var $name;
      function __set($propName, $propValue)
      {
         echo "Nonexistent variable: \$$propName!";
      }
   }

   $employee = new Staff();
   $employee->name = "Joe";
   $employee->title = "Developer";

?>
           
       








Related examples in the same category

1.set property