Total sum using view php
What you are trying to do is to use module in alpha version (bad practice) that keeps PHP code in database (very, very bad practice)  for task that can be accomplished by modules without these flaws, like Views Calc, Views Aggregator Plus or even built-in aggregation.

My current favourite is Views Aggregator Plus:


  In addition to what Views and Views Calc do, this module:
  
  
  enumerates group members
  produces tallies, i.e. textual histograms
  aggregates on Views PHP code-snippet evalutations
  can filter out result rows on regexp patterns
  gives you sorting on Views' Math expressions
  can process Webform submissions
  lets you add your own custom aggregation functions
  


And example on it's page is quite similar to what you want to accomplish here.

For a whole table sum, just add Global: mathematical expression column to sum values in row, and then Views Aggregator Plus to sum that column. Column may be hidden, for example with CSS.