 <p>If your input file has Windows line endings (CRLF) you will need to add an <code>\r</code> to your <code>explode</code> call, i.e. replace your <code>explode("\n", $input_lines)</code> with <code>explode("\r\n", $input_lines)</code></p>