method_exists() function checks to see if a particular method, exists. : method_exists « Reflection « PHP






method_exists() function checks to see if a particular method, exists.

 
Its syntax is: bool method_exists (object obj_name, string method_name)

<?
     class Car {
          var $fourWheel;
          function set() {
               $this->fourWeel = 1;
          }
     }

     $car = new Car;
     if (method_exists($car, "set")) :
          print "yes";
     else :
          print "no";
     endif;
?>
  
  








Related examples in the same category