Page 1 of 1

is there any php function for checking variable description?

Posted: Mon Feb 16, 2009 4:06 pm
by metaclay
hi, i'm php newbie, usually the big script is broke down into smaller file to make them more easy to debug and making a good structure. Now in my case:

1. i create a lot of functions saved in many different file, then within the main php file i use include to call the function. I have a variable , let's call it $finalresult, which is an instance of a class/obj , where this class is also an instance of another class, and so on.... . So sometime after instancing in many level, i forgot the structure of this $final variable. so i have to go up level then opening the reference class one by one until i got the master class. If i have to do it over and over again , it will need a lot of time. so my question.. is there any other faster way to do it? for example .. is there any php function that can show the structure of the variable in detail??

2. is there any php script editor software where i can do something like inserting the breakpoint , so i can run and debug easily. or where i can run the script line by line, so i can watch the changes of my variable in realtime. is it possible? is there such program?? sorry for the stupid question :D


thanx
andi

Re: is there any php function for checking variable description?

Posted: Mon Feb 16, 2009 4:07 pm
by Benjamin

Code: Select all

 
var_dump();
debug_backtrace();
 
Eclipse PDT may offer the debug feature you require.

Re: is there any php function for checking variable description?

Posted: Mon Feb 16, 2009 4:37 pm
by Weirdan
metaclay wrote:2. is there any php script editor software where i can do something like inserting the breakpoint , so i can run and debug easily. or where i can run the script line by line, so i can watch the changes of my variable in realtime. is it possible? is there such program?? sorry for the stupid question :D
You can use either xdebug (free) or zend platform debugger (costly) for this.

Code: Select all

 
var_dump();
debug_backtrace();
 
+

Code: Select all

 
class_parents();
class_implements();
get_class_methods();
get_object_vars();
ReflectionClass();
// etc