Flexible HTML table generation in PHP