Folder::count()

Counts the number of files contained in the folder.

Table of Contents
  1. Description
  2. Example

Description

Folder::count(): int;

This method is a requirement to be able to implement the Countable interface and aims to make the object countable via the count() function. This method is public, so it can also be called as how you would call any public methods in general. This method returns the number of files contained in the folder if the folder exists, otherwise, it returns 0.

Example

$folder = new Folder('.\path\to\folder');

test($folder->count()); // Returns the number of files contained in the folder
test(count($folder)); // Returns the number of files contained in the folder

Folder::count()

Counts the number of files contained in the folder.

Folder::size()

Gets the total sizes of files contained in the folder in human readable string format.