I have a foreach loop for 'n' number of cubicles. I want to display 4 cubicles in each row and reaminig in next row. How to limit 4 cubicles in each row within foreach loop.
Right now below code display all cubicles in one row
print '<table border="2">';
print '<tr>';
foreach($Cubicle as $cubicle )
{
print '<td>';
if($nodeStatus == '0'){
printf('<a href= "#" style="color: green; font-weight:bold" onClick="showDetails(\'%s\');">%s</a> ', $nodeId,$insert);
}
elseif($nodeStatus == '1'){
printf('<a href= "#" style="color: #AF7817; font-weight:bold" onClick="showDetails(\'%s\');">%s</a> ', $nodeId,$insert);
}
else{
printf('<a href= "#" style="color: RED; font-weight:bold" onClick="showDetails(\'%s\');">%s</a> ', $nodeId,$insert);
}
print '</td>';
}