php教程

CachingIterator::getFlags

(PHP 5 >= 5.2.0, PHP 7)

CachingIterator::getFlagsGet flags used

说明

public CachingIterator::getFlags ( void ) : int
Warning

本函数还未编写文档,仅有参数列表。

Get the bitmask of the flags used for this CachingIterator instance.

参数

此函数没有参数。

返回值

Description...

User Contributed Notes

Anonymous 06-Feb-2015 09:57
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;

/*
output:
toString this class

*/
?>
kais7mg at qq dot com 06-Feb-2015 09:49
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

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788