Class information is Abstract, is Final and is Instantiable : Reflection Class Definition : Class PHP Source Code


PHP Source Code » Class » Reflection Class Definition »

 

Class information is Abstract, is Final and is Instantiable




<?php
class Person {
    private $name;    
    private $age;    
    private $id;    

    function __construct$name, $age ) {
        $this->name = $name;
        $this->age = $age;
    }

    function setId$id ) {
        $this->id = $id;
    }
    
    function getId(){
        echo "get id method";    
    }
    
    function __clone() {
        $this->id = 0;
    }
}

$p = new ReflectionClass'Person' );

print classData$p );

function classDataReflectionClass $class ) {
  $details = "";
  $name = $class->getName();
  if $class->isAbstract() ) {
    $details .= "$name is an abstract classn"
  }
  if $class->isFinal() ) {
    $details .= "$name is a final classn"
  }
  if $class->isInstantiable() ) {
    $details .= "$name can be instantiatedn"
  else {
    $details .= "$name can not be instantiatedn"
  }
  return $details;
}

?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Class
» Reflection Class Definition