|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-12-28 03:00 UTC] julian at beta4 dot com
when you get the stack trace from debug_backtrace(), alal the frames for calls to functions within a file have no function arguments listed. If you move a function into another file and call it, then its arguments will be listed. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 07:00:02 2025 UTC |
Ok... you need 2 files. --------------file1.php----------------------- <?php require 'file2.php'; function f2($param) { f3($param); } function f1($param) { f2($param); } f1('foo'); ?> ----------end file1.php--------------- ----------file2.php--------------- <?php function f3($param) { echo '<table border="1">'; $backtrace = debug_backtrace(); foreach ( $backtrace as $frame ) { echo "<tr><td>$frame[file]</td><td>$frame[line]</td><td>$frame[function]</td><td>"; print_r($frame['args']); echo "</td></tr>\n"; } echo '</table>'; } ?> -------------end file2.php--------------- On my server (apache2, php4.3) I get: /home/julian/public_html/file1.php 5 f3 Array ( [0] => foo ) /home/julian/public_html/file1.php 9 f2 /home/julian/public_html/file1.php 12 f1 But on my friend's server (apache1.3, php4.3) - though there are surely plenty of other differences as well - I get: /web/sites/Julian/docs/file1.php 5 f3 Array ( [0] => foo ) /web/sites/Julian/docs/file1.php 9 f2 Array ( [0] => foo ) /web/sites/Julian/docs/file1.php 12 f1 Array ( [0] => foo )