I need this for debugging purposes and need to dump all variables. Is there a way to get all variables? and is there any way to trace all calls after script ends? without changing my code. Note that i can't use xdebug or anything installable because my script is runnign on a host.
Check out the get_defined_vars function within PHP.
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.