title: Multidimensional-splfixedarray for integers in PHP
body: <p>My question is organizing a one-dimensional list of numbers into a two-dimensional table with a variable number of columns to the right.</p>
  <p>The lengths of the column should be balanced so that all rows except the last are filled. The empty space in the last row should be at the right end of the row.</p>
  <h3>EXAMPLE:</h3>
  <pre><code>    List: 1,5,1,3,6,2,8,7,4,9,5,6,25,4,8,5,63
  
      COLUMNS: 5
  
      TABLE: 1 6 4 6  8
             5 2 9 25 5
             1 8 5 4  63
             3 7
  </code></pre>
  <p>I have to write a program (using PHP) to read a collection of records (&lt;100), each with a positive integer in columns 1-5. A zero value terminates the list. A second set of records should be read next, with various positive integers values for C, the number of columns, in columns 1-5. After each value of C is read, the sum of the elements in each row of the table should be computed and printed. Sums will be less than 9 digits. The two-dimensional table itself should not be printed.</p>
  <p>Using the sample data shown above for various values of C, output similar to the following should be produced:</p>
  <h3>For example:</h3>
  <pre><code>   C   ROW SUM
     5   25 41 81 10
     ***************************
     1   153
     ***************************
  </code></pre>
  <p>Either vertical or horizontal printing of row sums is acceptable, but a line of asterisks should separate output generated for different values of C. A zero value for C should cause the program to terminate.</p>