Hello
I'm having trouble retrieving the return of a model and using it in a foreach, without the function being executed again several times ...
How can I do to get the return and use this same return several times?
Code for illustration:
$valorModel = $this->model->funcao(); // recupera o return
foreach ($var as $var2) {
$array = array(
'colunaDb' => $var2->item,
'colunaDb' => $valorModel, // executa a função varias vezes
'colunaDb' => $var2->item
);
}