略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: CachingIterator::getFlags

2024-11-23

CachingIterator::getFlags

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

CachingIterator::getFlagsGet flags used

说明

public CachingIterator::getFlags(): int
警告

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

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

参数

此函数没有参数。

返回值

Description...

add a noteadd a note

User Contributed Notes 2 notes

up
0
Anonymous
7 years ago
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

*/
?>
up
0
kais7mg at qq dot com
7 years ago
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

官方地址:https://www.php.net/manual/en/cachingiterator.getflags.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3