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
|