Might as well be in the foreach itself ...

    foreach (array_diff($keys, array('id', 'name')) as $key)