system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.cubrid system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.gii system.i18n system.i18n.gettext system.logging system.test system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.form system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers zii.behaviors zii.widgets zii.widgets.grid zii.widgets.jui

CStackIterator

system.collections
继承 class CStackIterator
实现 Iterator, Traversable
可用自 1.0
源码 framework/collections/CStackIterator.php
CStackIterator implements an iterator for CStack.

It allows CStack to return a new iterator for traversing the items in the stack.

公共方法

隐藏继承的方法

方法描述被定义在
__construct() Constructor. CStackIterator
current() Returns the current array item. CStackIterator
key() Returns the key of the current array item. CStackIterator
next() Moves the internal pointer to the next array item. CStackIterator
rewind() Rewinds internal array pointer. CStackIterator
valid() Returns whether there is an item at current position. CStackIterator

方法详情

__construct() 方法
public void __construct(array &$data)
$data array the data to be iterated through
源码: framework/collections/CStackIterator.php#39 (显示)
public function __construct(&$data)
{
    
$this->_d=&$data;
    
$this->_i=0;
    
$this->_c=count($this->_d);
}

Constructor.

current() 方法
public mixed current()
{return} mixed the current array item
源码: framework/collections/CStackIterator.php#70 (显示)
public function current()
{
    return 
$this->_d[$this->_i];
}

Returns the current array item. This method is required by the interface Iterator.

key() 方法
public integer key()
{return} integer the key of the current array item
源码: framework/collections/CStackIterator.php#60 (显示)
public function key()
{
    return 
$this->_i;
}

Returns the key of the current array item. This method is required by the interface Iterator.

next() 方法
public void next()
源码: framework/collections/CStackIterator.php#79 (显示)
public function next()
{
    
$this->_i++;
}

Moves the internal pointer to the next array item. This method is required by the interface Iterator.

rewind() 方法
public void rewind()
源码: framework/collections/CStackIterator.php#50 (显示)
public function rewind()
{
    
$this->_i=0;
}

Rewinds internal array pointer. This method is required by the interface Iterator.

valid() 方法
public boolean valid()
{return} boolean
源码: framework/collections/CStackIterator.php#89 (显示)
public function valid()
{
    return 
$this->_i<$this->_c;
}

Returns whether there is an item at current position. This method is required by the interface Iterator.