how to achieve functionality of #def of c in PHP
- by Sabya
Well, I don't know if thats what I want. But here is my problem:
In case of some error I am logging the FILE, CLASS, FUNCTION and LINE in a file. For that I am doing something like:
myLog('['. __FILE__ . ']' . '[' . __CLASS__ . ']' . '[' . __FUNCTION__ . ']' . '[' . __LINE__ . ']');
The problem is everywhere I've to repeat that code in the parameter. and If I want to change the format, I've to change everywhere.
How can I have something like:
myLog(LOG_MSG_FORMAT);
With PHP define it is not possible since it will give my the LINE number of the place where that definition is, not where the definition is getting used.
Any solution to this is welcome. I am not bitchy about having C like functionality of #def.