有没有办法从Zend集合中获取第一个项目而没有foreach语句

时间:2016-10-11 13:48:02

标签: php zend-framework collections

从字段集类中获取表单项时,我使用下面的代码并且它可以正常工作。问题是:是否可以在没有foreach语句的情况下获取$ item var?我希望这样的东西:$ collection-> {1} - > get('event_timeblock_label);

$collection = $this->form->get('timeblocks');

foreach($collection as $item) {}
echo $this->formLabel($item->get('event_timeblock_label'));

0 个答案:

没有答案