Might just be me, but I prefer spaces around operators. As in `if ($ch == "\r" && $nch == "\n") {`.

Any specific reason to remove the spaces? :)