array_walk

bool array_walk(array array, string func, mixed userdata) 

Applies a specified function to each element of an array, along with optional input.

Returns:

TRUE on success; NULL if given invalid arguments

Description:

Traverses the given array and passes each element into the given function in turn. The function given as func is called once for every element of array . The function named by func can accept up to three parameters for each element:

param1 Key of the current element
param2 Value of the current element
param3 Value of the userdata argument to array_walk(), if given

If the function named by func accepts more than three parameters, it generates a warning, unless that warning is suppressed either by using the error_reporting() ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.