开发者

How do I echo the number of items in an array?

开发者 https://www.devze.com 2023-01-02 16:42 出处:网络
A total newbie question I know. I\'m sing Zend framework, and sending an array from the controller: $this->开发者_Go百科;view->googleArray = $viewFeedArray;

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号