note 82720 added to faq
| From: | lozada_nico at yahoo dot com | Date: | Wed, 23 Apr 2008 13:20:44 +0000 |
| Subject: | note 82720 added to faq | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138695@lists.php.net to get a copy of this message | ||
I need some help from someone, I'm doing a reflextion class which read and show all features
about its methods, but when I want to explain all documentation about method wiht
var_export($class->getProperties(), 1), I can't explain documentacion of each one. Why I
need this explication, because I want to show a documentation about the class and the user only need
to write the name of the class. porpuse reengineer
this is the code:
/**
*information about class, example class.
*
*@author N.J.L.I.
*/
class personal{
private $date_a = " ";
private $arrays_val = " ";
private $inst = " ";
/**
*information about method CONSTRUCT
*
*/
public function __construct(){
$this->inst = new DB_Class();
$this->inst ->DB_Init();
}//function construct
/**
*information about method DESTRUCT
*
*/
public function __destruct(){
$this->inst = new DB_Class();
$this->inst ->DB_Desconectar();
}//function destruct
/**
*information about method SET_VALUES
*
*/
public function set_values($values){
$this->arrays_val = $values;
$this->date_a = $this->arrays_val["date_a"];
}//function set_values
}//class personal
$class = new ReflectionClass('personal');
// Print class methods
//printf("---> Methods: %s\n", var_export($class->getMethods(), 1));//here is the
problem //var_export get information structured and return valid PHP code.
$arreglo = var_export($class->getMethods(), 1);
echo $arreglo;
print_r ($arreglo);//get the same result like using echo.
//The above example will output:
array ( 0 => ReflectionMethod::__set_state(array( 'name' => '__construct',
'class' => 'personal', )), 1 => ReflectionMethod::__set_state(array(
'name' => '__destruct', 'class' => 'personal', )), 2
=> ReflectionMethod::__set_state(array( 'name' => 'set_values',
'class' => 'personal', )), )
I need from this output take for example:
array( 'name' => 'set_values', 'class' => 'personal',
) and call each one
$method = new ReflectionMethod('personal','set_values');
the output will be:
---> Documentation: '/** *information about method SET_VALUES * */'
----
Server IP: 200.6.154.201
Probable Submitter: 200.7.106.82
----
Manual Page -- http://www.php.net/manual/en/faq.php
Edit -- https://master.php.net/note/edit/82720
Del: integrated -- https://master.php.net/note/delete/82720/integrated
Del: useless -- https://master.php.net/note/delete/82720/useless
Del: bad code -- https://master.php.net/note/delete/82720/bad+code
Del: spam -- https://master.php.net/note/delete/82720/spam
Del: non-english -- https://master.php.net/note/delete/82720/non-english
Del: in docs -- https://master.php.net/note/delete/82720/in+docs
Del: other reasons-- https://master.php.net/note/delete/82720
Reject -- https://master.php.net/note/reject/82720
Search -- https://master.php.net/manage/user-notes.php