【发布时间】:2010-08-04 16:18:35
【问题描述】:
在执行foreach $object->result_array()时获取当前数组位置指针
嗨, 考虑一下这个,一个案例。
foreach($object->result_array() as $rs)
{
//how do i display the current array element index that is the iteration index.
//i want to call a function when the iterator is in the last-1 position.
// and more specifically i want to use it in this place and not any other for(;;) loops.
// and even it is an example with other loops then that is fine.
}
应该有一个选项或使用 current() 函数。 我已经尝试过,但我仍然需要做一些分析...... 我发布了这个帖子,而不是调试和跟踪数组元素。
最重要的是,是否可以使用 for 循环来做到这一点?
【问题讨论】:
标签: codeigniter