I have txt file its content like this
Hello
World
John
play
football
I want to delete the new line character when reading this
If your going to be putting the lines into an array, an assuming a reasonable file size you could try something like this.
$file = 'newline.txt';
$data = file_get_contents($file);
$lines = explode(PHP_EOL, $data);
/** Output would look like this
Array
(
[0] => Hello
[1] => World
[2] => John
[3] => play
[4] => football
)
*/