I am using print_r(debug_backtrace(), true) to retrieve a string representation of the debug backtrace. This works fine, as print_r handles recursion.
When I tried to recursively iterate through the debug_backtrace() return array before turning it into a string it ran into recursion and never ended.
Is there some simple way I can remove certain sensitive key/value pairs from the backtrace array? Perhaps some way to turn the array to a string using print_r, then back to an array with the recursive locations changed to the string RECURSION, which I could the iterate through.
I don't want to execute regular expressions on the string representation if possible.