PHP | Ds\Map values() Function
The Ds\Map::values() function is an inbuilt function in PHP which is used to return a sequence of the map’s values.
Syntax:
Ds\Sequence public Ds\Map::values ( void )
Parameters: This function does not accepts any parameters.
Return Value: It returns a Ds\Sequence containing all the values of the map.
Below programs illustrate the Ds\Map::values() function in PHP:
Program 1:
<?php // Declare a new map $map = new \Ds\Map(["a" => "Geeks", "b" => "for", "c" => "Geeks"]); print_r($map->values()); // Declare another new map $map = new \Ds\Map(["b" => "Computer", "e" => "Science", "f" => "Portal"]); print_r($map->values()); ?> |
Ds\Vector Object
(
[0] => Geeks
[1] => for
[2] => Geeks
)
Ds\Vector Object
(
[0] => Computer
[1] => Science
[2] => Portal
)
Program 2:
<?php // Declare a new map $map = new \Ds\Map(["Geeks1" => "computer", "Geeks2" => "science", "Geeks3" => 5, "Geeks4" => 20]); var_dump($map->values()); // Declare another new map $map = new \Ds\Map(["x" => "A", "y" => "B", "z" => "C"]); var_dump($map->values()); ?> |
object(Ds\Vector)#2 (4) {
[0]=>
string(8) "computer"
[1]=>
string(7) "science"
[2]=>
int(5)
[3]=>
int(20)
}
object(Ds\Vector)#1 (3) {
[0]=>
string(1) "A"
[1]=>
string(1) "B"
[2]=>
string(1) "C"
}
Reference: https://www.php.net/manual/en/ds-map.values.php
Recommended Posts:
- D3.js | d3.set.values() Function
- D3.js | d3.map.values() Function
- D3.js | d3.values() Function
- How to return multiple values from function in PHP?
- JavaScript | Return multiple values from function
- How to get the javascript function parameter names/values dynamically?
- How to get multiple selected values of select box in php?
- What are valid values for the id attribute in HTML?
- JavaScript | Get all non-unique values from an array
- How to check all values of an array are equal or not in JavaScript ?
- How to get all unique values (remove duplicates) in a JavaScript array?
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- p5.js | value() Function
- p5.js | nfp() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



