Walking array the PHP way, A look into array_walk()
If you’ve been developing with PHP for a while, you’ve probably come across this situation in the past: <?php foreach ($somearray as &$element) { $element = some_function($element); } It’s a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: array_walk().