InterviewSolution
| 1. |
How to terminate the execution of a script in PHP? |
|
Answer» To terminate the EXECUTION of the script in PHP, the EXIT() function is used. It is a built-in function that outputs a message and then terminates the current script. The message which you want to display is passed as a PARAMETER to the exit() function. Script termination will be done by this function after displaying the message. It is an alias of die() function. It doesn’t return any value. Syntax: exit(message) Where the message is a parameter to be passed as an argument. It defines a message or status. Example: The code given below will print a message and exit the current script. <?php$SITE = "https://www.interviewbit.com//";fopen($site,"r")or exit("Unable to connect to $site");?>ConclusionPHP proves to be a great tool for writing dynamic web pages. It is not restricted to use by professional web developers. Non-technical users can also easily learn a few handy tricks to make their web pages easier to manage thereby MAKING them more useful. Important Resources: PHP Developer PHP Developer Salary Features of PHP Difference Between PHP 5 and 7 PHP Frameworks PHP Projects PHP IDE
|
|