Can PHP exclude the newline character when reading line by line?

前端 未结 5 672
时光说笑
时光说笑 2021-01-15 05:50

I want to read line by line but I do not want to deal with newline, I want it to be removed so I only end up with the content of the line.

So right now my function i

5条回答
  •  無奈伤痛
    2021-01-15 06:10

    Either a regular expression (fetching the last occurence of \n in a line and stripping it) or simple $name = substr($name, 0, -2) would do the trick

提交回复
热议问题