I am having some issues on a large-ish project, and it boils down to a particular class is somehow being instantiated multiple times, which is causing un-needed replication / overheads.
Is there any way to find out automatically what file / line number it is being instantiated from?
I have seen this question here – Find where a class was instantiated but I am not getting a fatal error for it being redeclared so I dont think include / require is the problem.
in the constructor I have got it to output to a txt file with timestamp, just need to know where the offending code is and remove / streamline it
debug_backtrace() will give the whole shebang what happened. get_class($this) will give the top child class if you need just that.