added newlines replacement with PHP_EOL for input