Re: Foreach question
| From: | Michael McGlothlin | Date: | Thu, 15 Nov 2007 23:11:12 +0000 |
| Subject: | Re: Foreach question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-264657@lists.php.net to get a copy of this message | ||
$x = 0;
foreach ( $blah as $bleh ) {
$x = $x + 1;
print "$x: $bleh";
}
HI, I'm working with an associative array, and generating its data a form. I use foreach to loops the contents of the array and echo to print the table and the data. Everything goes well, however I would like to add a counter to print the row's number. The question : Am I able to add a counter within foreach to print the row number in each row using echo ?. I tried a few things but I couldn't. Thanks! Juan-- Michael McGlothlin Southwest Plumbing Supply