How to save the data after the loop in PHP?

I have a cycle:
for ($i=0; $i < 10; $i++) { 
 $id = $red[$i]->id;
 $tok = $red[$i]->tok;
 $nas = "id: $id <br> $tok";
}

How to save and add $nas in one row?
Example:id: 2124
fv4x8, id: 2125
а8р4...
April 3rd 20 at 17:42
2 answers
April 3rd 20 at 17:44
Solution
$nas .= "id: $id <br> $tok";
April 3rd 20 at 17:46
$nas = "" ;
for ($i=0; $i < 10; $i++) { 
 $nas. = "id:{$red[$i]->id}<br>{$red[$i]->tok} ;
} 
echo $nas;


So chtoli?

Find more questions by tags PHP