3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $i = 0; $header = 0; $hitungLoopingObat= 9; do{ $remainder = ($i+1) % 5; $head = ($remainder+$i) % 5; if($remainder == 1) echo "Header " .$header++. "\n"; echo "Obat Ke " . $remainder . "\n"; if( $remainder == 0) { echo "new line \n"; } $i++; } while($i <= $hitungLoopingObat); if($remainder > 0){ $loncat = (5 - $remainder)+1; for($j=0; $j<$loncat; $j++) { echo "Sisa New Line " .$loncat. "\n"; } }
based on 2Jl4X
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0beta1
Header 0 Obat Ke 1 Obat Ke 2 Obat Ke 3 Obat Ke 4 Obat Ke 0 new line Header 1 Obat Ke 1 Obat Ke 2 Obat Ke 3 Obat Ke 4 Obat Ke 0 new line