foreach loop in php count code example
Example: php foreach count rows
<?php
$count = 0;
foreach( $names as $name){
$count = $count + 1;
echo "<td>".$count. "</td>
"<td>".$name. "</td>";
}
echo $count;
?>
<?php
$count = 0;
foreach( $names as $name){
$count = $count + 1;
echo "<td>".$count. "</td>
"<td>".$name. "</td>";
}
echo $count;
?>