Looping through models

Hi! I have a form with a lot of models, and in my controller I want to loop through each model in oder to save them if they aren’t empty

I was doing something like this:

            if ($user->load(Yii::$app->request->post()))


            if ($animal->load(Yii::$app->request->post()))


            if ($bird->load(Yii::$app->request->post()))


But I think it would be better to loop through each one instead of writing for each one the same, how can this be done ?

Thanks! :)

foreach ([$user, $animal, $bird] as $model) {