views:

30

answers:

3

is there any way to get list of variables that were defined in function, or list of all accessible variables in a function?

+2  A: 

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.

Pekka
thanks, im an idiot, just read the manual for that function before posting question, but couldnt test it normally because of mistake in code
samrockon
A: 

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

Jim
thanks, but i needed vars defined in the function, not that are passed to func
samrockon
+1  A: 

http://php.net/manual/en/function.get-defined-vars.php

Documentation indeed ^^

MatTheCat