Change language

PHP Ds / Map toArray () function

|
Syntax:
array public DsMap::toArray (void)
Parameter: this function takes no parameters.Returned value:the function returns an associative array containing all the elements of the specified map instance.The programs below illustrate the Ds / Map::toArray()in PHP:Program 1:
// PHP program to illustrate the toArray() function $map = new DsMap ([1 = > 10, 2 = > 20, 3 = > 30]); print_r ( $map -> toArray());  
?>
Output:
Array ([1] = > 10 [2] = > 20 [3] = > 30)
Program 2:
// PHP program to illustrate the toArray() function $map = new DsMap ([ "first" = > " Geeks " , " second " = > "for" , "third" = > "Geek s " ]); print_r ( $map -> toArray());  
?>
Output:
Array ([first] = > Geeks [second] = > for [third] = > Geeks)
Link : http://php.net/manual/en/ds-map.toarray.php
SO 1 data error