What is the significance of setting a time limit for PHP scripts, and how can it impact the execution of a script?

Setting a time limit for PHP scripts is important to prevent scripts from running indefinitely and potentially causing performance issues or server crashes. By setting a time limit, you can ensure that scripts are executed within a specified timeframe, improving overall script efficiency and resource management.

// Set a time limit of 30 seconds for the PHP script
set_time_limit(30);

// Your PHP script code here