©
本文档使用 PHP中文网手册 发布
(PHP 5 >= 5.2.0)
CachingIterator::getFlags — Get flags used
本函数还未编写文档,仅有参数列表。
Get the bitmask of the flags used for this CachingIterator instance.
此函数没有参数。
Description...
[#1] Anonymous [2015-02-06 09:57:54]
use 'CachingIterator::TOSTRING_USE_INNER' flag
<?php
class A extends ArrayIterator {
public function __toString(){
return 'toString this class';
}
}
$iterator = new A(array('apple'=>10, 'banana'=>20, 'cat'=>30));
$cache = new CachingIterator($iterator, CachingIterator::TOSTRING_USE_INNER);
$cache->next();
$cache->next();
echo $cache;
?>
[#2] kais7mg at qq dot com [2015-02-06 09:49:45]
use the 'CachingIterator::TOSTRING_USE_KEY', when echo this Object,
output current 'key';
<?php
$iterator = new ArrayIterator(array('apple'=>10, 'banana'=>20, 'cat'=>30));
$cache = new CachingIterator($iterator, CachingIterator::TOSTRING_USE_KEY);
$cache->next();
$cache->next();
echo $cache;
?>
output:
banana