Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
I rarely work with PHP . Debugging mechanisms are terrible, often you need to debug them yourself :-)
Using breakpoints ( breakpoints ) greatly simplifies the process of debugging, finding errors. In C# , I sometimes write code in debug mode, stop the program at the right place, make changes, or even write significant amounts of code from scratch, move control to the right place, and I can immediately see what happens without unnecessary movements. Haven't seen this in PHP and doubt it's possible. But even simply viewing the state of variables and objects can save time. Without this, you will have to write status output code via var_dump , print_r or echo, clog the conclusion, break the eyes. You will have to jump between the code editor and the browser, wasting precious fractions of seconds for all sorts of nonsense, at the risk of making even more mistakes.
From a real practical example, I just debugged a function for processing text data. The function is recursive, the data processing process is relatively complex.
I set breakpoints, looked at what value the variable with the processed text has at each step. Identified a potential error location. Put more points in this place and looked in detail. It turned out that the problem was in the preg_replace function . Because with PHPI rarely work and forgot everything, I could not write the correct template right away, so I had to experiment directly at the breakpoint. I made a stop at a problematic place, opened a quick check window (I have Visual Studio ) and, right in real time, tried out different options for using the preg_replace function with the data (variables) that were in memory. Having received the desired result, I replaced the problematic code fragment. That's it, problem solved. Fast and simple, without unnecessary movements in the code.
To view the status of all available variables at the moment.
I would look at how you debug a project from several api services, none of which interacts with the browser. Without a debugger, it's just monstrous.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question