Change language

PHP ReflectionClass export () function

|
Syntax:
string ReflectionClass::export (mixed $argument, bool  $return = FALSE)
Parameters:This function takes two parameters as above and described below:
  • $argument :contains the custom class to be exported.
  • $return:is a Boolean TRUE or FALSE.
Returned value:this function returns as a string if the parameter is set to TRUE, otherwise it returns NULL.The programs below illustrate the ReflectionClass::export() function in PHP:Program 1:  
// Define a custom class ca Company class Company { public $var1 = ’GeeksforGeeks’ ; public $var2 = ’GFG’ ; public function type() { return ’ Company’ ; } }  
// Call the export function $A = ReflectionClass::export ( ’Company’ , $return = TRUE);  
// Get the return value var_dump ( $A ); ?>
Output:
string (389) "Class [class Company] {@@ /home/cg/root/7286175/main.php 4-11 - Constants [0] {} - Static properties [0] {} - Static methods [0] {} - Properties [2] {Property [public $var1] Property [public $var2]} - Methods [1] {Method [public method type] {@@ / home / cg / root / 7286175 / main. php 8 - 10}}} "
Program 2:  
// Call the export function for the built-in ReflectionClass $A = ReflectionClass::export ( ’ReflectionClass’ );  
// Get the return value var_dump ( $A ); ?>
Output:
Class [ class ReflectionClass implements Reflector] {- Constants [3] {Constant [integer IS_IMPLICIT_ABSTRACT] {16} Constant [integer IS_EXPLICIT_ABSTRACT] {32} Constant [integer IS_FINAL] {4}} - Static properties [0] {} - Static methods [1 ] {Method [ static public method export] {- Parameters [2] {Parameter # 0 [< required > $argument] Parameter # 1 [< optional > $return]}}} - Properties [1] {Property [< default > public $name]} - Methods [50] {Method [ final private method __clone] {- Parameters [0] {}} Method [ public method __construct] {- Parameters [1] {Parameter # 0 [< required > $argument]}} Method [ public method __toString] {- Parameters [0] {}} Method [ public method getName] {- Parameters [0] {}} Method [ public method isInternal] {- Parameters [0] {}} Method [ public method isUserDefined] {- Parameters [0] {}} Method [ public method isAnonymous] {- Parameters [0] {}} Method [ public method isInstantiable] {- Parameters [0] {}} Method [ public method isCloneable] {- Parameters [0] {}} Method [ public method getFileName] {- Parameters [0] {}} Method [ public method getStartLine] {- Parameters [0] {}} Method [ public method getEndLine] {- Parameters [0] {}} Method [ public method getDocComment] {- Parameters [0] {}} Method [ public method getConstructor] {- Parameters [0] {}} Method [ public method hasMethod] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getMethod] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getMethods] {- Parameters [1] {Parameter # 0 [< optional > $filter]}} Method [ public method hasProperty] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getProperty] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getProperties] {- Parameters [1] {Parameter # 0 [< optional > $filter]}} Method [ public method hasConstant] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getConstants] {- Parameters [0] {}} Method [ public method getConstant] {- Parameters [1] {Parameter # 0 [< required > $name]}} Method [ public method getInterfaces] {- Parameters [0] {}} Method [ public method getInterfaceNames] {- Parameters [0] {}} Method [ public method isInterface] {- Parameters [0] {}} Method [ public method getTraits] {- Parameters [0] {}} Method [ public method getTraitNames] {- Parameters [0] {}} Method [ public method getTraitAliases] {- Parameters [0] {}} Method [ public method isTrait] {- Parameters [0] {}} Method [ public method isAbstract] {- Parameters [0] {}} Method [ public method isFinal] {- Parameters [0] {}} Method [ public method getModifiers] {- Parameters [0] {}} Method [ public method isInstance] {- Parameters [1] {Parameter # 0 [< required > $object]}} Method [ public method newInstance] {- Parameters [1] {Parameter # 0 [< required > $args]}} Method [ public method newInstanceWithoutConstructor] {- Parameters [0] {}} Method [ public method newInstanceArgs] {- Parameters [1] {Parameter # 0 [< optional > array $args]}} Method [ public method getParentClass] {- Parameters [0] {}} Method [ public method isSubclassOf] {- Parameters [1] {Parameter # 0 [< required > $class]}} Method [ public method getStaticProperties] {- Parameters [0] {}} Method [ public method getStaticPropertyValue] {- Parameters [2] {Parameter # 0 [< required > $name] Parameter # 1 [< optional > $default]}} Method [ public method setStaticPropertyValue] {- Parameters [2] {Parameter # 0 [< required > $name] Parameter # 1 [< required > $value]}} Method [ public method getDefaultProperties] {- Parameters [0] {}} Method [ public method isIterateable] {- Parameters [0] {}} Method [ public method implementsInterface] {- Parameters [1] {Parameter # 0 [< required > $interface]}} Method [ public method getExtension] {- Parameters [0] {}} Method [ public method getExtensionName] {- Parameters [0] {}} Method [ public method inNamespace] {- Parameters [0] {}} Method [ public method getNamespaceName] {- Parameters [0] {}} Method [ public method getShortName] {- Parameters [0] {}}}} NULL
Link: https://secure.php.net/manual/en/reflectionclass.export.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method