return array (array) of a function in php

0

I am storing the data of a database in an array in a file called funcoes.php :

    while($line = mysqli_fetch_array($execute)){
        $tabela[$a][$b] = $line['Activit'];
        $tabela[$a][$b+1] = $line['Usuario'];
        $tabela[$a][$b+2] = $line['Data_monit'];
        $a++;
    }
    return array($tabela);

and insert the returned array into another array into another filter.php:

 $tabela = corrige_filter($data, $modulo, $usuario, $conexao);
 while($a < 10){
 echo '<tr>';
 echo '<td>'.$tabela[$a][$b].'</td>';
 echo '<td>'.$tabela[$a][$b+1].'</td>';
 echo '<td>'.$tabela[$a][$b+2].'</td>';
 echo '</tr>';
 $a++;
 }

As expected when I print the table, it does not return anything, so my question is, how to pass the array from the first function to another array with the same array format.

    
asked by anonymous 19.02.2018 / 20:26

1 answer

1

Simply use:

return $tabela;

By doing return array($tabela) you are wrapping the entire table (which was already array) in a new array.

    
19.02.2018 / 20:28