SplObjectStorage::setInfo

(PHP 5 >= 5.3.0, PHP 7)

SplObjectStorage::setInfoSets the data associated with the current iterator entry

说明

public SplObjectStorage::setInfo ( mixed $data ) : void

Associates data, or info, with the object currently pointed to by the iterator.

参数

data

The data to associate with the current iterator entry.

返回值

没有返回值。

范例

Example #1 SplObjectStorage::setInfo() example

<?php
$s 
= new SplObjectStorage();

$o1 = new StdClass;
$o2 = new StdClass;

$s->attach($o1"d1");
$s->attach($o2"d2");

$s->rewind();
while(
$s->valid()) {
    
$s->setInfo("new");
    
$s->next();
}
var_dump($s[$o1]);
var_dump($s[$o2]);
?>

以上例程的输出类似于:

string(3) "new"
string(3) "new"

参见

相关文章
php evloop creates evperiodic watcher object associated with the current event loop instancephp informix 函数 sets the current file or seek positionphp mongocursor sets whether this cursor will wait for a while for a tailable cursor to return more dataphp outeriterator returns the inner iterator for the current entryphp recursivearrayiterator returns an iterator for the current entry if it is an array or an objectphp recursivedirectoryiterator returns an iterator for the current entry if it is a directoryphp recursiveiterator returns an iterator for the current entryphp recursiveiterator returns if an iterator can be created for the current entryphp recursiveiteratoriterator the current active sub iteratorphp recursiveregexiterator returns an iterator for the current entryphp recursiveregexiterator returns whether an iterator can be obtained for the current entryphp solrcollapsefunction sets the initial size of the collapse data structures when collapsing on a numeric field onlyphp splobjectstorage returns the current storage entryphp splobjectstorage returns the data associated with the current iterator entryphp splobjectstorage returns the data associated with an objectphp splobjectstorage sets the data associated with the current iterator entryphp splobjectstorage returns if the current iterator entry is validphp swoole connection iterator return current connection entry.php swoole connection iterator check if current position is valid.php zookeeper sets the data associated with a node
关注编程学问公众号