parameter-class; get_declared_class(); get_class_methods(); get_class_vars(); is_object();-> parameter-obj name get_class();->parameter-object method_exists();-> parameter- obj,method name */ class student { public $sname,$sid,$per; function __construct($sn,$sid,$sper) { $this->sname = $sn ; $this->sid = $sid ; $this->per = $sper ; } function display_data() { echo"$this->sname$this->sid$this->per"; } } $s1=new student("rohit",101,92); $s1->display_data(); echo "Does class exists?:"; echo class_exists("student")?'Yes':'No'; $classes=get_declared_classes(); echo "Declared classes:"; print_r($classes); $classemethods=get_class_methods("student"); echo "Class Methods:"; print_r($classemethods); $classemethods=get_class_vars("student"); echo "Class variables:"; print_r($classemethods); echo "Is s1 an object?:"; echo is_object($s1)?'Yes':'No'; $classes=get_class($s1); echo "Class of S1 classes:"; print_r($classes); echo "Construct exists?:"; echo method_exists($s1,"__construct")?'Yes':'No'; ?>
0 Comments