I once read a way to do this, but am unable to find it now. The only thing that I could really suggest would be for the function to take an additional string argument. That string would pass the name of the calling function.
e.g.
function a() {
b("a");
}
function b($caller) {
print "Called by $caller";
}
It's not the most glorious way, but until I can find my book and get the proper way, I don't see how else to do it.