Skip to content
Related Articles

Related Articles

PHP | ReflectionExtension export() Function
  • Last Updated : 13 Dec, 2019

The ReflectionExtension::export() function is an inbuilt function in PHP which is used to return the export as a string if the return parameter is set to TRUE, otherwise NULL is returned.

Syntax:

string ReflectionExtension::export( string $name,
 string $return )

Parameters: This function accepts two parameters as mentioned above and described below:

  • $name: This parameter holds the export of reflection.
  • $return: This parameter holds the Boolean value. If its value is set to True then it will export the reflected extension. If its value is set to False then it will not export the reflected extension.

Return Value: This function returns the export as a string if the return parameter is set to TRUE, otherwise NULL is returned.

Below programs illustrate the ReflectionExtension::export() function in PHP:



Program_1:




<?php
  
// Defining an extension
$A = 'DOM';
  
// Using ReflectionExtension() over the 
// specified extension
$extension = new ReflectionExtension($A);
  
// Calling the export() function
$B = $extension->export($A, $return = FALSE);
  
// Getting the export as a string 
var_dump($B);
?>


Output:

Extension [ <persistent> extension #18 dom version 20031129 ] {

– Dependencies {
Dependency [ libxml (Required) ]
Dependency [ domxml (Conflicts) ]
}

– Constants [45] {
Constant [ integer XML_ELEMENT_NODE ] { 1 }
. . .
Constant [ integer DOM_VALIDATION_ERR ] { 16 }
}
. . .
. . .
– Parameters [3] {
Parameter #0 [ <required> $expr ]
Parameter #1 [ <optional> DOMNode or NULL $context ]
Parameter #2 [ <optional> $registerNodeNS ]
}
}

Method [ <internal:dom> public method registerPhpFunctions ] {

– Parameters [0] {
}
}
}
}
}
}

NULL



Program_2:




<?php
  
// Using ReflectionExtension() over 
// a extension xml
$extension = new ReflectionExtension('xml');
  
// Calling the export() function and
// Getting the export as a string 
var_dump($extension->export('xml', $return = TRUE));
?>


Output:

string(6209) “Extension [ <persistent> extension #15 xml version 7.0.33-0ubuntu0.16.04.7 ] {

– Dependencies {
Dependency [ libxml (Required) ]
}

. . .

Function [ <internal:xml> function utf8_decode ] {

– Parameters [1] {
Parameter #0 [ <required> $data ]
}
}
}
}

Reference: https://www.php.net/manual/en/reflectionextension.export.php

My Personal Notes arrow_drop_up
Recommended Articles
Page :