__FILE__ in eval returns file name with some text eval()’d code
Note that __FILE__ has a quirk when used inside an eval() call. It will tack on something like “(80) : eval()’d code” (the number may change) on the end of the string at run-time. In normal use __FILE__ will return full physical path of the current executing file but if __FILE__ is use inside eval() function then it will return full physical path of the current executing file but some unwanted text suffixed to it something like (11): eval()’d code.
The workaround is:
$script = ‘echo __FILE__;’;
$script = str_replace(‘__FILE__’,”preg_replace(‘@\(.*\(.*$@’, ”, __FILE__,1)”,$script);