is there any way to get list of variables that were defined in function, or list of all accessible variables in a function?
5
-
1for what purpose? documentation?bcosca– bcosca2010-10-22 10:01:31 +00:00Commented Oct 22, 2010 at 10:01
-
get_defined_vars(); But it returns an array of all defined variables not specific to a function.Asif Mulla– Asif Mulla2010-10-22 10:04:58 +00:00Commented Oct 22, 2010 at 10:04
-
@Asif nope, it should work fine if called within the functionPekka– Pekka2010-10-22 10:07:00 +00:00Commented Oct 22, 2010 at 10:07
-
Yes, Later realized the same.Asif Mulla– Asif Mulla2010-10-22 10:08:01 +00:00Commented Oct 22, 2010 at 10:08
-
i just include files within a function and i need to make variables defined there global, this is not great decision, but there is no better solution for nowsamrockon– samrockon2010-10-22 10:21:47 +00:00Commented Oct 22, 2010 at 10:21
Add a comment
|
3 Answers
There is get_defined_vars():
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.
it has to be called within each function you want to analyze, though.
1 Comment
samrockon
thanks, im an idiot, just read the manual for that function before posting question, but couldnt test it normally because of mistake in code
func_num_args — Returns the number of arguments passed to the function func_get_arg — Return an item from the argument list func_get_args — Returns an array comprising a function's argument list
1 Comment
samrockon
thanks, but i needed vars defined in the function, not that are passed to func