Recursive trim data Alters in-place AND returns the array This allows for use such as: $_SESSION['register']['field_values'] = Validator::trim($_POST); When used like this, the session gets set and the POST data is also trimmed, so can be used directly for database inserts.