Tools, FAQ, Tutorials:
Remove Trailing New Line Character in PHP
How To Remove the New Line Character from the End of a Text Line?
✍: FYIcenter.com
If you are using fgets() to read a line from a text file, you may want to use the chop() function to remove the new line character from the end of the line as shown in this PHP script:
<?php $handle = fopen("/tmp/inputfile.txt", "r"); while ($line=fgets()) { $line = chop($line); # process $line here... } fclose($handle); ?>
⇒ Removing Leading and Trailing Spaces in PHP
⇐ Ways to Remove Leading and Trailing White Spaces in PHP
2016-10-13, 1346👍, 0💬
Popular Posts:
How To Move Uploaded Files To Permanent Directory in PHP? PHP stores uploaded files in a temporary d...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...
How To Control Padding Spaces within a Table Cell? Cell padding spaces are spaces between cell inner...
FYIcenter JSON Validator and Formatter is an online tool that checks for syntax errors of JSON text ...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...