Debugging a PHP Web Application

Hi,

I am trying to understand how a PHP based web application works. I have setup debugging in Aptana Studio 3 and I can see where each steps proceed. But when the application goes into classes and references are used I am not able to understand or see the values the variables are being assigned.

Is there any way that I can see or print the values of each variable while debugging each step whether it is a reference variable or regular variable.

Kindly let me know if any more information is required.

Thanks in advance.
LVL 1
Vipin KumarSr. Network EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
You can, of course, use var_dump(), var_export() and error_log() to visualize and record the values, but generally, we do not do it that way.  Rather than looking at the values, we prefer to test the values programmatically.  The best debugging tools are unit test tools.  You write your code in testable units (usually classes and interfaces) then you use something like PHPUnit to test each of the testable units.  You write assertions saying what is expected from each test.  There may be a few different tests for each unit.  When all of your unit tests pass, you know that the units all work correctly.  

There are two big advantages to working this way.  First, you get all of the benefits of automated testing and you never have to worry if a change in one location of the code can cause a spooky action at a distance in another code location.  You can rerun the automated unit tests in a matter of seconds to prove that your application still works.  Second, you can refactor with relative freedom, since any breaking change will be caught by the unit tests.

From a philosophical standpoint, this article explains the methodology and illustrates a way of automated testing.  It was written before the days of PHPUnit, and today I would recommend learning PHPUnit and using it freely.  Once you see how well this works, you will never go back to "looking at variables" to see if your code is solid!
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7830-A-Quick-Tour-of-Test-Driven-Development.html

To learn more about PHPUnit...
https://phpunit.de/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
F PCommented:
Checkout x-debug...

http://xdebug.org/

not for production!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.