PHP Ds\Map toArray() Function Last Updated : 21 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Map::toArray() function in PHP is used to get an array generated by converting the Map instance into an Array. The resulting array is an associative array with elements as in same order as that of the specified Map instance. Syntax: array public Ds\Map::toArray ( void ) Parameter: This function does not accepts any parameter. Return value: The function returns an associative array containing all of the elements of the specified Map instance. Below programs illustrate the Ds\Map::toArray() function in PHP: Program 1: php <?php // PHP program to illustrate toArray() function $map = new \Ds\Map([1 => 10, 2 => 20, 3 => 30]); print_r($map->toArray()); ?> Output: Array ( [1] => 10 [2] => 20 [3] => 30 ) Program 2: php <?php // PHP program to illustrate toArray() function $map = new \Ds\Map(["first" => "Geeks", "second" => "for", "third" => "Geeks"]); print_r($map->toArray()); ?> Output: Array ( [first] => Geeks [second] => for [third] => Geeks ) Reference: http://php.net/manual/en/ds-map.toarray.php Comment More infoAdvertise with us Next Article PHP DsSet toArray() Function gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads PHP DsMap toArray() Function The Ds\Map::toArray() function in PHP is used to get an array generated by converting the Map instance into an Array. The resulting array is an associative array with elements as in same order as that of the specified Map instance. Syntax: array public Ds\Map::toArray ( void ) Parameter: This functi 1 min read PHP DsSet toArray() Function The Ds\Set::toArray() function of Ds\Set class in PHP is an inbuilt function which is used to convert the Set into an associative array. This does not modify the actual Set. This method returns an array with values of the Set without changing the order of elements. Syntax: array public Ds\Set::toArr 1 min read PHP | DsPair toArray() Function The Ds\Pair::toArray() function is an inbuilt function in PHP which is used to convert the Pair element into an associative array. This function does not modify the actual Pair. This method returns an array whose values without changing the order of elements. Syntax: array Ds\Pair::toArray( void ) P 1 min read PHP | DsStack 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 | DsDeque toArray() Function The Ds\Deque::toArray() function is an inbuilt function in PHP which is used to convert a Deque into an array. The elements of the array will be in the same order as they are in Deque. Syntax: public Ds\Deque::toArray( void ) : array Parameters: This function does not accept any parameter. Return Va 2 min read PHP | DsVector toArray() Function The Ds\Vector::toArray() function is an inbuilt function in PHP which is used to convert the vector into an array. All the elements of the vector are copied to the array.Syntax: array public Ds\Vector::toArray( void ) Parameters: This function does not accepts any parameters.Return Value: This funct 2 min read PHP | DsCollection toArray() Function The Ds\Collection::toArray() function is an inbuilt function in PHP which is used to converts the collections into array. Syntax: public Ds\Collection::toArray( void ) : array Parameters: This function does not accepts any parameters. Return Value: This function returns an array containing all colle 1 min read PHP | DsVector map() Function The Ds\Vector::map() function is an inbuilt function in PHP which is used to return the result of a callback after applying to each value in the vector. Syntax: Ds\Vector public Ds\Vector::map( $callback ) Parameters: This function accepts single parameter $callback which is to be applied to each ve 2 min read PHP | DsMap xor() Function The Ds\Map::xor() function is an inbuilt function in PHP which is used to create a new map which contains the value either in the first map or second map but not both. Syntax: Ds\Map public Ds\Map::xor ( Ds\Map $map ) Parameter: This parameter holds the other map of values. Return value: It is used 2 min read PHP var_dump() Function The var_dump() function in PHP is used to display structured information about one or more variables. The structured information means type and value of the given variable. It outputs not just the value of the variable but also its data type and, in the case of arrays or objects, all of their struct 2 min read Like