|
Main (PHP)
3rd Party Streams
Resources
Code Snippets
Affiliates
|
|
|
Affect an entire array |
|
2007-10-11 20:58:47, 4197 views, from category Top Level
|
|
How many times have you looped through an entire array and hit every element? PHP has a bulit-in mechanism for doing so: array_map(function, array).
array_map passes every element of the array to the function and replaces the element with the return value.
The function prototype is simple:
function x($y) {
return whatever_you_want_to_do($y);
} |
| |
|
|
|
|
|
|
Top Sponsor
Sponsors
Sponsors
Advertisting
Affiliates
|
|