The parameters that I am talking about are __FILE__
and __LINE__
- those of the caller of the function, so that the function can use them in error reporting.
Let's say that I have two files and line 100 of file_1.php calls my_func()
in file_2.php
I'd like to make that call my_func(__FILE__, __LINE__)
so that if my_func
encounters an error it can report it against file_1.php at line 100.
I do that since there are hundreds of calls to my_func
and reporting the error to be in my_func() itself might not be informative (unless I dump the stack). And I don't want to have to manually type those two parameters a few hundred times.
In C I would do something like #define MY_FUNC my_func(__FILE, __LINE)
- can I do something similar in PHP?