PHP array helper for reducing nestiness