How to return from a function an array with the data?

How to return from f-tsii an array with the data?

function Test() {
$query = mysql->query("SELECT * FROM `table` WHERE `table` = '1'");
// Something should be here.
return $data;

Suppose in the database there were 50 records, but f-tsiya only returns 1 record found first how to get all records? The foreach loop ?? Tried it, but it also displays 1 record.
I tried this:
foreach ($query as $result) {

If you specify var_dump and see what was found - lists all entries, I understand when we tell him Return it returns that found the first and considers the work performed, as to force to give out ALL the records?)
March 19th 20 at 09:05
1 answer
March 19th 20 at 09:07
in a loop to collect all in an array
foreach ($query as $result) {
$full_array[] = $result;
return $full_array;

Find more questions by tags PHP