Array
(
[0] => Array
(
[file] => script.php
[line] => 18
[function] => query_wrapper
[args] => Array
(
[0] => SELECT * FROM msg WHERE id=abc
)
)
[1] => Array
(
[file] => script.php
[line] => 25
[function] => get_message
[args] => Array
(
[0] => abc
)
)
[2] => Array
(
[file] => script.php
[line] => 28
[function] => foo
[args] => Array
(
)
)
)
<?php
function generate_backtrace($bt_array)
{
// reverse array so we move from start to finish
rsort($bt_array);
$str = '';
foreach ($bt_array as $entries) {
$str .= "{$entries['file']}:{$entries['line']} {$entries['function']}(".implode(', ', $entries['args']).")\n";
}
return $str;
}
?>