php8.5
Home/ Manual/ ds / collection/ Ds\Collection::isEmpty

Ds\Collection::isEmpty

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Returns whether the collection is empty

Description

Ds\Collection::isEmpty(): bool

Returns whether the collection is empty.

Parameters Parameters

Return Values

Returns true if the collection is empty, false otherwise.

Examples

Ds\Collection::isEmpty() example

php
<?php
$a = new \Ds\Vector([1, 2, 3]);
$b = new \Ds\Vector();

var_dump($a->isEmpty());
var_dump($b->isEmpty());
?>

The above example will output something similar to:

output
bool(false)
bool(true)

Source: reference/ds/ds/collection/isempty.xml · from the official PHP manual (php/doc-en)