You need to add break line to your code.
there is some ways which i know and you have to use them on where needed for example using <br>
is ok for html but might not gonna work if you are not using php in html codes.
For using in html try this edited code :
$roomCount = count($_POST["room_nos"]);
for($i=0;$i<$roomCount;$i++) {
foreach($roomsCount as $value){
}
$output.= $roomsCount[$i]."<br>";
// edited over here // ."<br>" added to your code
}
echo $output;
For using in JavaScript or jQuery string returns or console.log or other things you can use this code too :
$roomCount = count($_POST["room_nos"]);
for($i=0;$i<$roomCount;$i++) {
foreach($roomsCount as $value){
}
$output.= $roomsCount[$i]."\n";
// edited over here // ."\n" added to your code
}
echo $output;
Also if you are trying to save it on database or using on any API you might need to use this code PHP_EOL
like this :
$roomCount = count($_POST["room_nos"]);
for($i=0;$i<$roomCount;$i++) {
foreach($roomsCount as $value){
}
$output.= $roomsCount[$i].PHP_EOL;
// edited over here // .PHP_EOL added to your code
}
echo $output;
I not sure its all things which you can use but its all codes which i knew i hope its resolve your problem.
';` What you use might depend on context, but the main point is that you need to tell your program to output each value on a new line. – Wesley Smith Oct 24 '20 at 20:17
'; – Nipun Tharuka Oct 29 '20 at 11:45