Let's say I have a function called outputFile($source, $outputFileName, $message), and that it lives in a file called utils.php.
When I invoke this function, I always pass __FILE__ for the first parameter (i.e., $source). Let's say I'm calling that function while in index.php. So when I call the function like this: outputFile(__FILE__, "someFileName", "Hello World"), it would output to my log file something like this:
I'm kind of getting tired of having to type __FILE__ all the time when I call my outputFile function. Is there a way for my function to internally
pick up which file it is being invoked from? In other words, if I were in index.php, is there a way my outputFile() function can know it was invoked from index.php and use that as the $source? I know if I hardcoded __FILE__ in outputFile(), it's going to output "utils.php" (where it lives) rather than where it was invoked.