Voting

: six plus two?
(Example: nine)

The Note You're Voting On

d at rren dot me
12 years ago
Howdy guys, just a note really - The ['args'] data within the resulting array is supplied by reference. I found myself editing the reference unknowingly which in turn shows its ugly head further down the line if you call multiple backtrace.

<?php
$trace
= array_reverse(debug_backtrace());

// LOOP BACKTRACE
$la = 0;
$lb = count($trace);
while (
$la<$lb){

// DATA FROM BACKTRACE
$trace[$la]['file'];
$trace[$la]['line'];
$trace[$la]['args'];
$trace[$la]['function'];
// DATA FROM BACKTRACE

// LOOP ARGUMENTS ARRAY
$ba = 0;
$bb = count($trace[$la]['args']);
while (
$ba<$bb){

$trace[$la]['args'][$ba] = "EDITING A REFERENCE/POINTER";

$ba++;
}
unset(
$bb);
unset(
$ba);
// LOOP ARGUMENTS ARRAY

$la++;
}
unset(
$lb);
unset(
$la);
// LOOP BACKTRACE
?>

<< Back to user notes page

To Top