How do I echo the number of items in an array?
A total newbie question I know.
I'm sing Zend framework, and sending an array from the controller:
$this->开发者_Go百科;view->googleArray = $viewFeedArray;
In the view, I have a foreach loop that is populating a table with the array contents.
<?php
foreach($this->googleArray as $row) { ?>
<tr>
<td><?php echo $row['when']; ?></td>
...
...
</tr>
<?php
}
?>
It all works fine. At the top of the table, I want to list the number of items in the array.
Something like (which doesn't work):
<?php echo $this->googleArray->totalResults; ?> event(s) found
How would I do that?
Thanks!
Tried this?
<?php echo count($this->googleArray); ?> event(s) found
精彩评论