table [ i ] will be storing the number of solutions for value i . We need n + 1 rows as the table is constructed in bottom up manner using the base case ( n = 0 )
$ table = array_fill ( 0 , $ n + 1 , NULl ) ;