Condition logic

Good time of the day. Help me understand the logic.

while (!feof($fg)) {

If the loop value is true, then the loop body will be executed.
A file descriptor (let’s say at the beginning of the file), which means that feof()will return false.
!– negation. It turns out: we deny negation – we get the truth?
Reach end of file – feof()will return true. Deny the truth, receive a lie? Loop stops running?
I’m just getting started with PHP. Explain the logic, please.

Answer 1, authority 100%

That’s exactly what it is, we execute until we come across the end of the file.

You can imagine it in Russian:

(  ($fg)) {

Until the end of the file – feof($fg)returns true– the loop body is executed because the condition will be (due to the negation operator) true. As soon as by the beginning of the next iteration it turns out that we are at the end of the file, we will get while (!true)= while (false), and we will not execute the loop.

Answer 2

It looks like php is your first language. Many do not recommend doing this. Although I would not say that starting with a high-level language, you can “kill the programmer in yourself in the bud.” Although for me the first language was assembler, the second was C. I do not think that if I started with php, I would not succeed. Learn and enjoy life, in general, and listen to those who know. Good luck)