, and then called in the file function. Directly write w,w+ is not quite concise, why do you want to go around the circle?
Some frameworks even define the 60 of a minute with 60 seconds as a constant, and a long constant name. Why do you use constants for something that will never change? And I think it's not a poor form of readability to write $t=3600*24.
Reply content:
, and then called in the file function. Directly write w,w+ is not quite concise, why do you want to go around the circle?
Some frameworks even define the 60 of a minute with 60 seconds as a constant, and a long constant name. Why do you use constants for something that will never change? And I think it's not a poor form of readability to write $t=3600*24.
Xie invited
Variable full name is for readability, example thinkphp5 the previous time single-letter function has been criticized is no readability can not see on the understanding
Constants are generally defined in a file or in the same location for easy maintenance
Can be repeatedly called by multiple places, once modified only one place
Because this value is definitely called by the entire project many times, if not configured as a constant, once you want to modify this value, it is very likely to miss out.
1 The current time is defined as constant to reduce the time error, which is generally defined at the entrance. Because of the business logic, the request time is not equal to your data storage time. For example, when a user clicks submit an answer, your business logic is to execute 100 million cycles and then write to the database. Then the operating time of your database record and the actual user's operating time are in a bad value.
2 prevent time () Multiple use causes time difference
3 There is a large extent is installed force, conform to, there is the first framework to write, the new framework will certainly refer to others before the development, but also the same writing.
Like a judgment statement.
if($a>1){$a=1;}
Some people write this
if($a>1) $a=1;
Some people write this
$a>1 and $a=1;
And there's this writing
$a>1 && $a=1;
As long as you can read it, you can use one of your own habits.