Remainder program with 'for' loop not working

I am trying to run a simple remainder program but its not displaying any logical result. My program is:

for ($i=200; $i<250; $i++) { 
   $rem1 = ($i%4); 
   if ($rem1 === 0) 
      echo  "$i" . "<BR>"; 

It displays following stuff:

"; } ?>

Somebody please guide me whatis the problem with the above code.


The script looks fine and when I copied and pasted to a file the output was the same?

I created a new file, tested a simple echo and the output was as expected.

I then added your script and the results were as expected?

I think the original file must have had an incorrect BOM header value.

1 Like

That’s the output you would get if the file had an .html suffix and was double clicked on rather than a .php suffix and opened on a server.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.