Skip to Main Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

9.12 Einen Stacktrace ausgeben

Problem

Sie möchten wissen, was an einem bestimmten Punkt Ihres Programms und auf den Stufen zu diesem Punkt passiert.

Lösung

Nutzen Sie debug_print_backtrace( ):

function stooges() {
  print "woo woo woo!\n";
  larry();
}
function larry() {
  curly();
}
function curly() {
  moe();
}
function moe() {
  debug_print_backtrace();
}
stooges();

Das erzeugt folgende Ausgabe:

woo woo woo!
#0  moe() called at [backtrace.php:14]
#1  curly() called at [backtrace.php:10]
#2  larry() called at [backtrace.php:6]
#3  stooges() called at [backtrace.php:21]

Diskussion

Die Funktion debug_backtrace( ) wurde in PHP 4.3.0 eingeführt, und in PHP 5.0.0 wurde die praktische Funktion debug_print_backtrace( ) ergänzt. Mithilfe dieser Funktionen können Sie sich ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi
CSS Kochbuch, 3rd Edition

CSS Kochbuch, 3rd Edition

Joergen Lang, Christopher Schmitt

Publisher Resources

ISBN: 9783868993271Purchase book