Re: tracing a PHP script
Swincher wrote:
> Hi, all - --
>
> I an building my first extensive PHP application. As I am doing so, I
> have backed myself into a corner where some messed-up logic is
> stumping me big-time.
>
> Is there a tool or technique with which I can step through the script
> or trace through it so I can see the point at which my logic is
> dropping down the hopper?
I normally work with a lot of userdefined functions & classes. In the
development fase, I often do this:
$flow = array();
And in functions:
global $flow;
$flow[] = debug_backtrace();
Which will give you method / function, class, line, filename & arguments
used.
print_r($flow); will give me the total flow until that point.
You could print_r(array_slice($flow,-15)) to get only the last 15 statements
to avoid huge amounts of OK code to read through.
Grtz,
--
Rik Wasmus
|