Better use of array_walk