PHP debug function

Function for debugging in PHP:

function create_debug_data($linebreak = "<br />") {
  $data = "";
  $debug = array_reverse(debug_backtrace());
  array_pop($debug);
  foreach ($debug as $row) {
    $data .= $row["file"] . " " . $row["line"] . ". line, ";
    $data .= (isset($row["class"])) ? $row["class"] . ": " : "";
    if (isset($row["function"])) {
      $data .= $row["function"] . "(";
      if (isset($row["args"]) and is_array($row["args"])) {
        foreach ($row["args"] as $arg) {
          if (is_object($arg)) $arg = "[class " . get_class($arg) . "]";
          if (is_bool($arg)) $arg = $arg ? "TRUE" : "FALSE";
          $data .= $arg . ", ";
        };
        if (substr($data, -2) == ", ") $data = substr($data, 0, -2);
      };
      $data .= ")";
    };
    $data .= $linebreak;
  };
  return $data;
}