Created
February 21, 2013 22:03
-
-
Save argestes/5008720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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