Populating an array from a database
As noticed by mmm a solution might be (if applicable) to slice results. Anyway, here is my suggestion for the process to be as thrifty as possible.

// First create a specific model version appropriate to current results structure
$curModel = [];
$resultSample = reset($results);
foreach ($model as $attribute =&gt; $ope) {
  // keep only useful attributes
  if (array_key_exists($attribute, $resultSample) {
    // flip params list to have param as key
    $curModel[$attribute] = [
      'function' =&gt; $ope['function'],
      'params' =&gt; array_flip($params),
    ];
  }
}

// Then work:
// . without having to check if some attribute applies
// . with the ability to use array_intersect_key() to provide params
foreach ($results as &amp;$itemResult) {
  foreach ($curModel as $attribute =&gt; $ope) {
    $function = $ope['function'];
    $itemResult[$attribute] =
      $function(array_intersect_key($itemResult, $ope['params']));
  }
}


It's based on the attempt to move as much work as possible, from the loop where it's repetitively executed, to a preparatory work executed once:


build a version of $model strictly suitable for the current results structure (so we don't have to check it further)
invert the nested iterations: rather than iterate on $model attributes and look if applicable, now we know that the $model contains only applicable attributes, so for each one we can directly work with the current record contents


At the same time, I chose to simplify the transformer function invocation: passing a unique array argument avoids using call_user_func_array(). Note that it needs the adaptation of the transformer functions, but it should be quite easy.

A few more little things:


I stopped using a temporary copy of $itemResult, which is useless
I used as much PHP specific functions as possible (instead of a sequence of statements) to reduce processor consumption: array_flip(), array_intersect_key()