xdebug is an immensely powerful tool for exploring what your code really does.
You can get a long way using print_r but ultimately this always requires that you predict the path your code will take - and the tricky bit about debugging is you need it when your predications have gone wrong.
It’s generally pretty easy to set up
- install the php5-xdebug package
- check that the Eclipse PHP preferences have xdebug as an option
- if you’re debugging locally the default settings should be OK
- create a site configuration in the debug dialog
- set a break point
- start debugging
If it doesn’t work at first restart Eclipse
Check that you have a browser configured in Eclipse
Not all settings seem to be picked up immediately