php8.5
Home/ Manual/ ds / stack/ Ds\Stack::isEmpty

Ds\Stack::isEmpty

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Returns whether the stack is empty

Description

Ds\Stack::isEmpty(): bool

Returns whether the stack is empty.

Parameters Parameters

Return Values

Returns true if the stack is empty, false otherwise.

Examples

Ds\Stack::isEmpty() example

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

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/stack/isempty.xml · from the official PHP manual (php/doc-en)