Skip to content

Instantly share code, notes, and snippets.

@cloned
Created November 19, 2018 02:52
Show Gist options
  • Save cloned/df8eab520b3280d7f7e606f4e115c93b to your computer and use it in GitHub Desktop.
Save cloned/df8eab520b3280d7f7e606f4e115c93b to your computer and use it in GitHub Desktop.
echo json_encode(debug_backtrace(), JSON_PRETTY_PRINT) . PHP_EOL;
@cloned
Copy link
Author

cloned commented Feb 25, 2019

If you just want to know which codes are calling the function, you can also do like this.

foreach (debug_backtrace() as $t) {
    if (array_key_exists('file', $t)) {
        echo $t['file'] . ':' . $t['line'] . PHP_EOL;
    }
}

http://php.net/manual/ja/function.debug-backtrace.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment