Skip to content

Instantly share code, notes, and snippets.

@argestes
Created February 21, 2013 22:03
Show Gist options
  • Save argestes/5008720 to your computer and use it in GitHub Desktop.
Save argestes/5008720 to your computer and use it in GitHub Desktop.
<?php
function create_table_row($variable,$title)
{
$row = '';
if (!empty($variable)) {
$row .='<th rowspan="'.count($variable).'">'.$title.'</th>';
$i = 0; $numItems = count($variable);
if($numItems>1)
foreach ($variable as $area ) {
$row .='<td>'.$area.'</td>';
if(++$i !== $numItems){
$row .= '</tr><tr>';
}
else $row .= '</tr>';
}
else
$row .='<td>'.$variable.'</td></tr>';
}
echo $row;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment