There is a way to find all the arrays stored into a PHP document?
If I have:
$one = array();
$two = array();
$foo = array();
How can I get a list of them into an array like:
$arrays = array($one, $two, $foo);
?
There is a way to find all the arrays stored into a PHP document?
If I have:
$one = array();
$two = array();
$foo = array();
How can I get a list of them into an array like:
$arrays = array($one, $two, $foo);
?
You can use get_defined_vars():
array get_defined_vars ( void )
This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that get_defined_vars() is called.
As it will show up all the environment, server and your variables, you need to "grep" those you want.
grep -v way: delete all HTTP variables we know are always set, so the ones that stay are the ones we define.get_defined_vars() before and after including the document, so the difference will be the new ones.