Problems with php opening files

I read the contents of a file through fread and determine how many lines there are in the file by reading the number of file newline characters (PHP_EOL), but the result is always one line less than the normal result. I want to ask if there is no newline after the last line but the file Terminator. Thank you

Php
Feb.19,2022

should be the last line without a newline character

Editing under Linux VIM automatically adds a newline character to the last line

I edited three rows of data in VIM (the last line did not enter), and what I saw was

clipboard.png

windows

clipboard.png

found that there is no corresponding newline character on the last line, which should be because of this

.
Menu