如何回显数组中的项目数?

时间:2010-06-06 06:40:46

标签: php oop zend-framework

我知道的一个新手问题。

我正在唱Zend框架,并从控制器发送一个数组:

$this->view->googleArray = $viewFeedArray;

在视图中,我有一个foreach循环,用数组内容填充表。

<?php 
foreach($this->googleArray as $row) { ?>
  <tr>          
    <td><?php echo $row['when']; ?></td>
    ...
    ...
  </tr>
<?php
}
?>

一切正常。在表格的顶部,我想列出数组中的项目数。

类似的东西(不起作用):

 <?php echo $this->googleArray->totalResults; ?> event(s) found

我该怎么做?

谢谢!

1 个答案:

答案 0 :(得分:8)

试过这个?

<?php echo count($this->googleArray); ?> event(s) found
相关问题