$ m = 3; // Number of lines $ n = 5; // Number of numbers in the string It is necessary to make the generation of random numbers and sort them
$m = 3;$n = 5; for($r=0; $r<$m; $r++) { for($i=0; $i<$n; $i++) { $arr[$i] = rand(0,$n); asort($arr); foreach ($arr as $item) { print_r($item); } } echo '<br />'; }