Jeff Moore has a new post showing an example of a feature that will be included in the upcoming PHP 5.3 release - closures/lambda functions.
Dagfinn has a post looking at using the new closure feature of PHP 5.3. He compares using foreach for iteration versus array_map. "Interesting," he concludes, "but not necessarily better than conventional alternatives." I agree for that case. Consider instead, a more complicated operation that requires a setup and a tear down after.
Jeff's example proposes that, instead of duplicating code, you use a lambda function to handle the custom parsing of the data as needed and pass that into the "doIt" function in his example.