atbjk Posted November 4, 2006 Share Posted November 4, 2006 hi, i am trying to give a function a unique name based on where it is called in the page.for example:i would call the function like so in a page called test.php lets say the line i call test is 20test();this is located in another file function.inc its lines are from 1-3function test($temp=__LINE__){ echo $temp;}when test echos temp it would give me the line where __LINE__ appears(1).is there a way to find where a function is executed or how to give it a unique name or how to make __LINE__ dynamic?? Link to comment https://forums.phpfreaks.com/topic/26165-i-have-a-function-problem/ Share on other sites More sharing options...
heckenschutze Posted November 4, 2006 Share Posted November 4, 2006 Since the __LINE__ constant is in fact for debugging, the only real way to do it (using __LINE__ at least...) is to pass the line as a function parameter.test.php[code]test(__LINE__);[/code]function.inc[code]function test($ln){ echo $ln;}[/code]hth... Link to comment https://forums.phpfreaks.com/topic/26165-i-have-a-function-problem/#findComment-119687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.