I often see statements like this:
$file = fopen($filename, r) or die("Sorry, cannot open: $filename");
or is understood like this here, because in PHP does not distinguish between data types, so $file can be either int or bool, so such a statement will not report an error. But some friends may not understand the processing process.
In fact, in most languages, in statements like bool or bool, if the previous value is true, the next value will not be judged. The same is true here, so if the fopen function is executed correctly, it will return an int value greater than 0 (which is actually "true"), and the subsequent statements will not be executed. If the fopen function fails to execute, it will return false, and then it will be judged whether the following expression is true.
After executing die(), no matter what is returned, the program has stopped executing and the specified error message is displayed, thus achieving the purpose of debugging.
That’s it. :)