PHP | Ds\Collection isEmpty() Function Last Updated : 21 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Below programs illustrate the Ds\Collection::isEmpty() function in PHP: Example 1: php <?php // Create a collection $collection = new \Ds\Vector([10, 15, 21, 13, 16, 18]); // Use isEmpty function $res = $collection->isEmpty(); // Display the result var_dump($res); // Create a collection $collection = new \Ds\Vector(); // Use isEmpty function $res = $collection->isEmpty(); // Display the result var_dump($res); ?> Output: bool(false) bool(true) Example 2: php <?php // Create a collection $collection = new \Ds\Vector(); // display output var_dump($collection->isEmpty()); // Create a collection $collection = new \Ds\Vector([1, 3, 5, 2, 6]); // Display output var_dump($collection->isEmpty()); ?> Output: bool(true) bool(false) Reference: http://php.net/manual/en/ds-collection.isempty.php Comment More infoAdvertise with us Next Article PHP | DsVector isEmpty() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DS\Collection Similar Reads 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 | 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 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 | 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 | 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 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 | Ds\Collection isEmpty() Function min read Like