How to remove newlines when reading files line by line in PHP
WBOYOriginal
2016-07-25 09:13:131014browse
Example, PHP reads a file line by line and removes the newline character "n":
//First type:
$content=str_replace("n","",$content);
echo $content;
/ /Or:
$content=str_replace(array("n","r"),"",$content);
//Second type:
$content=preg_replace(" /s/","",$content);
echo $content;
//Third type:
$content=trim($content);
Copy code
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn