PHP | Ds\Stack isEmpty() Function Last Updated : 18 Jan, 2021 Comments Improve Suggest changes Like Article Like Report The Ds\Stack::isEmpty() function of PHP Ds\Stack class is used to check whether a Stack is empty or not. This method returns a boolean value, True if the Stack is empty otherwise it returns False. Syntax: bool public Ds\Stack::isEmpty ( void ) Parameter: This function does not accept any parameters.Return Value: This function returns a boolean value True if the stack is Empty otherwise it returns False. Below programs illustrate the Ds\Stack::isEmpty() function: Program 1: PHP <?php // PHP program to illustrate the // Ds\stack::isEmpty() function // Create a Stack instance $stack = new \Ds\Stack(); // Check if stack is Empty var_dump($stack->isEmpty()); // Pushing elements to Stack $stack->push("Welcome"); $stack->push("to"); $stack->push("GfG"); // Check if stack is Empty again var_dump($stack->isEmpty()); ?> Output: bool(true) bool(false) Program 2: PHP <?php // PHP program to illustrate the // Ds\stack::isEmpty() function // Create a Stack instance $stack = new \Ds\Stack(); // Check if stack is Empty var_dump($stack->isEmpty()); // Pushing Mixed value elements to Stack $stack->push("Welcome"); $stack->push("to"); $stack->push("GfG"); $stack->push(10); $stack->push(5.5); // Check if stack is Empty again var_dump($stack->isEmpty()); ?> Output: bool(true) bool(false) Reference: http://php.net/manual/en/ds-stack.isempty.php Comment More infoAdvertise with us Next Article PHP | DsDeque isEmpty() Function gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_stack Similar Reads PHP DsSet isEmpty() Function The Ds\Set::isEmpty() function of Ds\Set class in PHP is an inbuilt function which is used to check whether a set is empty or not. If the Set instance is empty then this function returns true otherwise it returns False. Syntax: bool public Ds\Set::isEmpty ( void ) Parameters: This function does not 1 min read PHP | DsStack isEmpty() Function The Ds\Stack::isEmpty() function of PHP Ds\Stack class is used to check whether a Stack is empty or not. This method returns a boolean value, True if the Stack is empty otherwise it returns False. Syntax: bool public Ds\Stack::isEmpty ( void ) Parameter: This function does not accept any parameters. 1 min read PHP | DsDeque isEmpty() Function The Ds\Deque::isEmpty() function is an inbuilt function in PHP which is used to check the Deque is empty or not. Syntax: public Ds\Deque::isEmpty( void ) : bool Parameters: This function does not accept any parameter. Return Value: This function returns true if the Deque is empty, else return false. 1 min read PHP DsQueue isEmpty() Function The Ds\Queue::isEmpty() Function in PHP is used to whether a particular Queue instance is empty or not. It returns True if the Queue is empty otherwise it returns False. Syntax: bool public Ds\Queue::isEmpty ( void ) Parameters: This function does not accepts any parameters. Return Value: This funct 1 min read PHP SplHeap isEmpty() Function The SplHeap::isEmpty() function is an inbuilt function in PHP which is used to check whether the heap is empty or not. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. The sam 2 min read PHP | DsVector isEmpty() Function The Ds\Vector::isEmpty() function is an inbuilt function in PHP which is used to check the vector is empty or not. Syntax: bool public Ds\Vector::isEmpty( void ) Parameters: This function does not accept any parameter. Return Value: This function returns true if the vector is empty, false otherwise. 1 min read PHP | DsCollection isEmpty() Function The Ds\Collection::isEmpty() function is an inbuilt function in PHP which is used to returns whether collection is empty. Syntax: Ds\Collection::isEmpty ( void ) : bool Parameters: This function does not accepts any parameters. Return Value: It returns True if collection is empty or False otherwise. 1 min read PHP isset() Function The isset() function in PHP checks whether a variable is declared and not NULL. It returns true if the variable exists and has a non-NULL value, and false otherwise, without modifying the variable. Syntaxbool isset( mixed $var [, mixed $... ] )Parameters: This function accept one or more parameter a 3 min read PHP DsPriorityQueue isEmpty() Function The isEmpty() Function of Ds\PriorityQueue class in PHP is used to whether a particular PriorityQueue instance is empty or not. It returns True if the PriorityQueue is empty otherwise it returns False. Syntax: bool isEmpty( ) Parameters: This function does not accepts any parameters. Return Value: T 1 min read PHP | DsDeque insert() Function The Ds\Deque::insert() function is an inbuilt function in PHP which is used to insert the value at the given index in the Deque. Syntax: public Ds\Deque::insert( $index, $values ) : void Parameters: This function accepts two parameter as mentioned above and described below: $index: This parameter ho 2 min read Like