for the specific use of these two functions, let's take a look at it first, Array_walk, the code is as follows:
Its output reads as follows:Array (size=5) 0 + int 4 1 = int 2 = int 3 = int- 4 = int 49
And for Array_map, let's take an example:
Its output reads as follows:Array (size=4) 0 = int 1 = int 2 = int 3 = int 40
We can see that both functions can be implemented for things like traversing an array, but in general, they focus differently:
(1) Array_map can traverse n arrays at the same time, while Array_walk is usually traversing one.
(2) Array_map must have a return value because its return value needs to form a new array. But Array_walk is usually not necessary because its usual use is to change the original data.
(3) Array_map usually have a function of the data, but Array_walk does not recommend deleting and adding the data, it is recommended to modify the value only.
Of course, they can achieve the same function in some cases, they are not distinct, but have a certain intersection.
The above describes the Sinsing analysis of Array_walk and array_map of the relationship and differences, including the array,walk aspects of the content, I hope that the PHP tutorial interested in a friend helpful.