Put bunch of echo calls in the code and try to figure out the logic it's following. Also, use some more descriptive variable names. Nobody wants to debug that when they have no idea wtf it means and months down the line when you use it for reference you'll have no idea what it means either.