(PHP 7 >= 7.2.0, PHP 8)
ReflectionClass::isIterable — Check whether this class is iterable
Check whether this class is iterable (i.e. can be used inside foreach).
此函數(shù)沒有參數(shù)。
成功時返回 true
, 或者在失敗時返回 false
。
示例 #1 Basic ReflectionClass::isIterable() Usage
以上例程會輸出:
Is ArrayObject iterable? bool(true) Is IteratorClass iterable? bool(true) Is DerivedClass iterable? bool(true) Is NonIterator iterable? bool(false)