PHP: Get PHP's variables, functions, constants from a php file -


Is there a way to define user defined php works, variable, from a php file? The following functions are the best way to do this because they are not all decalred functions / wars / constants (built-in constants and hundreds of php functions with built-in php functions):

Suppose I would like this file to be myfile.php :

  & lt; Php $ title = 'sample application'; $ Copyright = 'copyright and copy; 2009 '; $ My_array = array ('Sarfraz', 'Ahmed', 'Chandio'); Define ('_CASTE', 'Chandio'); Define ('___', 'Pakistan'); Add function ($ val1, $ val2) {return ($ val1 + $ val2); } Decrease function ($ val1, $ val2) {return ($ val1 - $ val2); }? & Gt;  

Now how can I get all the variables / functions / constants from that file and maybe store in an array?

Thanks

You probably want to try PHP Tokenizer

< P>

From an external script:.

  & lt ;? Php var_dump (token_get_all (file_get_contents ('myscript.php'))); ? & Gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -