What potential pitfalls should be considered when passing arrays from PHP to Smarty templates for table population?

When passing arrays from PHP to Smarty templates for table population, it is important to ensure that the array is properly formatted and structured to be easily looped through in the template. Potential pitfalls to consider include ensuring that the array keys and values are correctly mapped to the table columns, handling empty or null values gracefully, and avoiding complex nested arrays that may be difficult to iterate over in the template.

// Example of properly formatting an array for table population in Smarty
$data = [
    ['id' => 1, 'name' => 'John Doe', 'age' => 30],
    ['id' => 2, 'name' => 'Jane Smith', 'age' => 25],
    ['id' => 3, 'name' => 'Alice Johnson', 'age' => 35],
];

$smarty->assign('tableData', $data);