I have this array that has two $rows:
I'd like the second array's display to be based on the first array but I don't think I have it set up properly:
$rows = &$vars['rows'];
foreach ($rows[0] as $key => $value) {
if (strpos($key, 'views') === 0 && empty($value)) {
$rows[1][$key] = '';
unset($vars['header'][$key]);
}
}
This is the output from the code, you can see the table doesn't seem aligned properly:
You need to loop over the whole array and then loop over the inner data as well. Simply you need two foreach loops.
$rows = $vars;
foreach ($rows as $occ => $outer ) {
foreach ($outer as $key => $value) {
if (strpos($key, 'views') === 0 && $value =='') {
unset($vars[$occ][$key]);
}
}
}