PHP Ds\Queue toArray() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The Ds\Queue::toArray() Function in PHP is used to convert a Queue into an associative array in PHP. The values of the Queue are assigned to the array in the same order as they are present in the Queue. Syntax: array public Ds\Queue::toArray ( void ) Parameters: This function does not accepts any parameters. Return Value: This function converts the Queue into an associative array and returns the array. Below program illustrate the Ds\Queue::toArray() Function in PHP: php <?php // Declare new Queue $q = new \Ds\Queue(); // Add elements to the Queue $q->push("One", 1); $q->push("Two", 2); $q->push("Three", 3); echo "The equivalent array is: \n"; print_r($q->toArray()); Output: The equivalent array is: Array ( [0] => One [1] => 1 [2] => Two [3] => 2 [4] => Three [5] => 3 ) Reference: https://www.php.net/manual/en/ds-queue.toarray.php Comment More infoAdvertise with us Next Article PHP | Ds\Stack toArray() Function G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_queue Similar Reads PHP Ds\PriorityQueue toArray() Function The Ds\PriorityQueue::toArray() Function in PHP is used to convert a PriorityQueue into an associative array in PHP. The values of the PriorityQueue are assigned to the array in order of decreasing priority. Syntax: array public Ds\PriorityQueue::toArray ( void ) Parameters: This function does not a 1 min read PHP Ds\PriorityQueue toArray() Function The Ds\PriorityQueue::toArray() Function in PHP is used to convert a PriorityQueue into an associative array in PHP. The values of the PriorityQueue are assigned to the array in order of decreasing priority. Syntax: array public Ds\PriorityQueue::toArray ( void ) Parameters: This function does not a 1 min read PHP | Ds\Stack toArray() Function The Ds\Stack::toArray() function of PHP is used to convert the stack to an array and returns the converted array. This function does not modify the actual Stack. Syntax: void public Ds\Stack::toArray () Parameters: This function does not accept any parameters. Return Value: This function returns the 2 min read PHP | Ds\Stack toArray() Function The Ds\Stack::toArray() function of PHP is used to convert the stack to an array and returns the converted array. This function does not modify the actual Stack. Syntax: void public Ds\Stack::toArray () Parameters: This function does not accept any parameters. Return Value: This function returns the 2 min read PHP Ds\Queue pop() Function The Ds\Queue::pop() Function in PHP is used to remove and return the value present at the top of the Queue. In other words, it returns the value present at the front of the Queue and also removes it from the Queue. Syntax: mixed public Ds\Queue::pop ( void ) Parameters: This function does not accept 2 min read PHP Ds\Queue pop() Function The Ds\Queue::pop() Function in PHP is used to remove and return the value present at the top of the Queue. In other words, it returns the value present at the front of the Queue and also removes it from the Queue. Syntax: mixed public Ds\Queue::pop ( void ) Parameters: This function does not accept 2 min read Like