표준 PHP 라이브러리(SPL) GlobIterator::count

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

GlobIterator::count — 디렉토리 및 파일 수 얻기


설명

public GlobIterator::count(): int

glob 표현식에서 찾은 디렉토리 및 파일 수를 가져옵니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

반환된 디렉토리 및 파일의 수(int로).


Examples

예제 #1 GlobIterator::count() 예제

                  
<?php
$iterator = new GlobIterator('*.xml');

printf("Matched %d item(s)\r\n", $iterator->count());
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

Matched 8 item(s)
                

기타

  • GlobIterator::__construct() - glob을 사용하여 디렉토리 생성
  • count() - 배열 또는 Countable 개체의 모든 요소를 ​​셉니다.
  • glob() - 패턴과 일치하는 경로 이름 찾기