Home  >  Article  >  Backend Development  >  PHP review and consolidation notes

PHP review and consolidation notes

WBOY
WBOYOriginal
2016-08-08 09:29:371033browse

On weekdays, I am busy writing reports, holding meetings, and tracking progress. Most of the basic coding work is left to my subordinates.

It’s approaching the Spring Festival holiday, and everyone has gone back for the holidays. I have nothing to do and refresh myself on PHP. So I compiled it into study notes for my own reference.

1. The usage of or in the basic tutorial


or is understood here, because data types are not distinguished in PHP, so $myfile can be either int or bool, so such a statement will not report an error . 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 following 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. As a result, after die() is executed, no matter what is returned, the program has stopped executing and the specified error message is displayed, thus achieving the purpose of debugging.

Similar usages such as:

defined('YII_DEBUG') or define('YII_DEBUG',true);

2,

The above introduces the PHP review and consolidation notes, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn