PHP | Ds\Deque count() Function Last Updated : 14 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Ds\Deque::count() function is an inbuilt function in PHP which is used to get the number of elements in the Deque. Syntax: public Ds\Deque::count( void ) : int Parameters: This function does not accept any parameter. Return Value: This function returns the number of elements in the Deque. Below programs illustrate the Ds\Deque::count() function in PHP: Program 1: PHP <?php // Declare a deque $deck = new \Ds\Deque([1, 2, 3, 4, 5, 6]); echo("Elements in the Deque\n"); // Display the Deque elements print_r($deck); echo("\nNumber of elements in the Deque: "); print_r($deck->count()); ?> Output: Elements in the Deque Ds\Deque Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 ) Number of elements in the Deque: 6 Program 2: PHP <?php // Declare a deque $deck = new \Ds\Deque(["geeks", "for", "geeks"]); echo("Elements in the Deque\n"); // Display the Deque elements print_r($deck); echo("\nNumber of elements in the Deque: "); print_r($deck->count()); ?> Output: Elements in the Deque Ds\Deque Object ( [0] => geeks [1] => for [2] => geeks ) Number of elements in the Deque: 3 Reference: http://php.net/manual/en/ds-deque.count.php Comment More infoAdvertise with us Next Article PHP DsQueue count() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_deque Similar Reads PHP | DsDeque count() Function The Ds\Deque::count() function is an inbuilt function in PHP which is used to get the number of elements in the Deque. Syntax: public Ds\Deque::count( void ) : int Parameters: This function does not accept any parameter. Return Value: This function returns the number of elements in the Deque. Below 1 min read PHP DsQueue count() Function The Ds\Queue::count() Function in PHP is used to get the count of elements present in a Queue instance. Syntax: int public Ds\Queue::count ( void ) Parameters: This function does not accepts any parameters. Return Value: This function calculates the number of elements present in a Queue instance and 1 min read PHP DsSet count() Function The Ds\Set::count() function of Ds\Set class in PHP is an inbuilt function which is used to count the number of values present in the Set. This is also referred to as the size of the Set instance. Syntax: int public Ds\Set::count() Parameters: This function does not accept any parameter. Return Valu 1 min read PHP | DsDeque contains() Function The Ds\Deque::contains() function is an inbuilt function in PHP which is used to check the deque contains given values or not. Syntax: bool Ds\Deque::contains( $values ) Parameters: This function accepts single or many $values which hold the value to check that value exist in the deque or not. Retur 1 min read PHP | DsDeque __construct() Function The Ds\Deque::__construct() function is an inbuilt function in PHP which is used to create a new instance. Syntax: Ds\Deque::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs illustrate 2 min read PHP | DsDeque copy() Function The Ds\Deque::copy() function is an inbuilt function in PHP which is used to return a copy of the Deque. This will return a shallow copy of the Deque. Syntax: public Ds\Deque::copy ( void ) : Ds\Deque Parameters: This function does not contain any parameter. Return Value: This function returns a cop 2 min read PHP | Ds\Deque count() Function min read Like