Php 有没有办法不使用foreach语句就从Zend集合中获取第一项
当从fieldset类中获取表单项时,我使用下面的代码,它可以工作。问题是:是否有可能在没有foreach语句的情况下获得$item var?类似这样的东西就是我想要的:$collection->{1}->get('event\u timeblock\u label)Php 有没有办法不使用foreach语句就从Zend集合中获取第一项,php,zend-framework,collections,Php,Zend Framework,Collections,当从fieldset类中获取表单项时,我使用下面的代码,它可以工作。问题是:是否有可能在没有foreach语句的情况下获得$item var?类似这样的东西就是我想要的:$collection->{1}->get('event\u timeblock\u label) $collection = $this->form->get('timeblocks'); foreach($collection as $item) {} echo $this->formLabel($ite
$collection = $this->form->get('timeblocks');
foreach($collection as $item) {}
echo $this->formLabel($item->get('event_timeblock_label'));