changed argument order
Table implements SPL Countable
first checks if $data is array
resets array before looping