|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-12 10:24 UTC] blanke at ddd dot de
Hi there !
I think it would be great if it would be possible to find out from which line of a script a function has been called.
example
1 function blah()
2 {
3 echo("Function blah has been called from line 6");
4 }
5
6 blah();
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 13:00:01 2025 UTC |
Hi there! That's correct, that __LINE__ contains the !current! Line-Number. But I what to know from which line a function has been called. > > > > 1 function blah() > > 2 { > > 3 echo("Function blah has been called from line 6"); > > 4 } > > 5 > > 6 blah(); > > In line 3, i don't want to know the CURRENT line Number. I'd like to know the Line-Number from which that Function has been called. mfg, Nico Blanke.what about function foo($line) { echo 'the function was called in line: '.$line } foo(__LINE__); ?Try debug_backtrace(). <?php function test() { var_dump(debug_backtrace()); } test(); ?>