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.
Ds\Vector public Ds\Vector::map( $callback )
Parameters: This function accepts single parameter $callback which is to be applied to each vector elements.
Return Value: This function returns the vector after applying the callback to each value in the vector.
Below programs illustrate the Ds\Vector::map() function in PHP:
Ds\Vector Object (  => 10  => 20  => 30  => 40  => 50 )
Program 2:This program shows the implementation of map() function which sets 1 in the vector for each element satisfying the condition in callback.
Ds\Vector Object (  => 1  => 1  => 1  =>  => )
- How to get the function name inside a function in PHP ?
- PHP | cos( ) Function
- PHP | sin( ) Function
- p5.js | mag() Function
- D3.js | d3.map.set() Function
- PHP Ds\Map sum() Function
- PHP | Ds\Set first() Function
- p5.js | sin() function
- PHP | Ds\Map first() Function
- p5.js | tan() function
- PHP | tan( ) Function
- PHP | Ds\Set last() 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 email@example.com. 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.