What's going on with the newline character here?

Add a reply

Posted by stumpokapow 831 days ago:
I am submitting the following entry to the "Home on the Range" challenge:
Source Code (PHP)
Live Test
Test Input

As you can see, the output for this challenge is accurate. This submission, however, fails because the output seems to insert a linebreak in between the range of numbers and the fullstop character that ends the range of numbers. There is nothing in the code that to my knowledge would insert a linebreak (so having that happen when uploading is unexpected), and as you can see from the copy running on my server, no linebreak is inserted in results not run on Code Golf.

If coders/admins can view submissions of competitors, the submission is here:
http://codegolf.com/competition/results/171/6

You can see that the issue is that a linebreak is inserted before the fullstop for every run of the program.

If this is somehow an issue in my code, forget that I posted this, and I'll try to track it down and fix it. I really don't see what the cause would be, so I'm assuming there's an issue with the environment in which PHP is being executed.
Posted by will 831 days ago:
You can see that the issue is that a linebreak is inserted before the fullstop for every run of the program.

Try chomp'ing the input string.
Posted by stumpokapow 831 days ago:
Try chomp'ing the input string.

This indeed did work. I'm not entirely sure, though, why this was happening on CodeGolf and not on my server. I'm assuming it's something to do with the fact that CodeGolf's CLI input ended up having a return character versus the file I was piping in to test didn't?

Add a reply