I'm sorry, I thought you were originally saying that $notifications_total was the problem (someone else had a similar problem recently), but I guess that isn't it. I must admit that I don't understand what you are trying to do here. I don't know what hook location you are using nor what output you are trying to achieve. Maybe an image would help out?