Although you still might resort to this approach if you’re a systems programmer, very few developers nowadays would ever need to do this.
So if that’s all you have, thinking about how you got there and using judiciously-placed print statements isn’t a bad move.
But for a lot of problems, you’re still going to fix it faster with thought and print.
Print statement version:
if ($somevar==‘foo’) {
echo(‘Called bar with foo’);
}
…which I’d need to remember to remove once I’m done.
The fact that I’m interested in knowing what a function receives for the sake of debugging shouldn’t impinge on the actual source code of that function. It has nothing to do with that function. My business is not its business.
If nothing else, it’ll save you the embarrassment consequent on accidentally committing a forgotten “log(`SUPER_SECRET_KEY`)” to a public repo on GitHub ;-)
/end
Probably break the thread now 😕