コード例 #1
0
ファイル: IteratorImpl.php プロジェクト: umanari145/phptips
 /**
  * @chainable
  * @category  Arrays
  * @param     array  $xs
  * @return    Iterator
  */
 public static function reverse($xs)
 {
     return new Iterator\DeferIterator(function () use($xs) {
         return new \ArrayIterator(ArrayImpl::reverse($xs));
     });
 }
コード例 #2
0
ファイル: GeneratorImpl.php プロジェクト: umanari145/phptips
 /**
  * @chainable
  * @category  Arrays
  * @param     array  $xs
  * @return    Generator
  */
 public static function reverse($xs)
 {
     foreach (ArrayImpl::reverse($xs) as $x) {
         (yield $x);
     }
 }