Get the App
SLTechnology News&Howtos  ›  Development  › 

How php does not limit execution time

Shulou Source: shulou.com Published: 2022-06-03 10:38:35 09月20日 Update

This article is to share with you about how php does not limit the execution time, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

In PHP, you can use the set_time_limit () function to limit the execution time, which sets the maximum execution time of the script file and allows the script to execute indefinitely when the parameter value is set to 0; syntax "set_time_limit (0)".

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In PHP, you can use the set_time_limit () function to unlimited execution time. You only need to set the following code:

Set_time_limit (0)

Set_time_limit-sets the maximum execution time of the script in seconds. If this setting is exceeded, the script returns a fatal error. The default value is 30 seconds, or the value defined in the max_execution_time of php.ini, if this value exists.

When this function is called, set_time_limit () restarts the timeout counter from scratch. In other words, if the timeout defaults to 30 seconds, and set_time_limit (20) is called when the script runs for 25 seconds, the total time for the script to run before timeout is 45 seconds.

If the parameter value of the set_time_limit () function is set to 0 (zero), there is no time limit, and the program can be executed indefinitely.

This is how php does not limit the execution time. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Time script limit function maximum parameter unlimited more knowledge article run utility code unit that is work meeting in other words tutorials files articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Docker MySQL Apple