I am using the following to return a file path and line number of a method
echo (__METHOD__) "() - LN:" (__LINE__) " & lt; br;
I really want to update this class (say comment.php)
class comment {public static function show (echo) (echo __way__) . "() - Ln:" (__LINE__) " & lt; br; }}
that I can call anywhere in my development
if (comment) comment: show ();
and it has returned the file path of the calling code. I have tried some forms but I am missing something Can you help?
Thank you
Check out - this can give you information about the caller In whatever you need.
For example:
& lt ;? Php class comment {public static function show () {$ trace = debug_backtrace (); Print_r ($ trace); } Public Function Testing () {Comment :: Show (); }} Comment = new comment (); $ Comment-> testing ();
will produce this output
array ([0] => array ([file] => /tmp/test.php [Line] = & gt; 13 [function] = & gt; show [class] => comment [type] =>: [args] => aa ()) [1] = & gt; Hey ([file] = & gt; /tmp/test.php [line] => 1 9 [function] => test [class] => comment [object] => comment object ( The first element shows the collar details - format it according to your liking; [type] = & gt; - & gt; [Args] = & gt; Array ()))
And if it helps, then complete Display call stack!
Comments
Post a Comment