il tuo problema è proprio number_format, fai prima l'addizione e poi usa number_format.