ibnclaudius Posted June 28, 2012 Share Posted June 28, 2012 Is there a better way to do this? $i = 0; foreach ($posts as $post) { $posts[$i]['function_return'] = function($post['function_param']); $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/264921-apply-a-function-to-every-member-of-an-array/ Share on other sites More sharing options...
Barand Posted June 28, 2012 Share Posted June 28, 2012 foreach ($posts as $i => $post) { $posts[$i]['function_return'] = function($post['function_param']); } Quote Link to comment https://forums.phpfreaks.com/topic/264921-apply-a-function-to-every-member-of-an-array/#findComment-1357646 Share on other sites More sharing options...
ibnclaudius Posted June 28, 2012 Author Share Posted June 28, 2012 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/264921-apply-a-function-to-every-member-of-an-array/#findComment-1357651 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.