Not in pure-PHP, no -- as far as i know.
But you can use a debugger ; a nice way to do that is with
- The extension Xdebug, which can be used as a debugger
- and some graphical IDE that integrates some debugging tools, like Eclipse PDT
Both of those are free, btw.
With those, you can do step by step, set up breakpoints, watch the content of variables, view stack traces, ... And it works both for Web and CLI scripts ;-)
Of course, it means having Eclipse running on the machine you are executing your script... But if you are executing it on your development machine, you probably have a GUI and all that, so it should be fine...
(I know that, for web applications, you can have Eclipse running on a different machine than the one with the PHP webserver -- don't know if it's possible in CLI, though)
As a sidenote : maybe you can integrate Xdebug with a CLI-based debugger ; see the page I linked to earlier for a list of supported tools.