How to terminate the execution of a script in PHP?

0

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.

Conclusion

PHP 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.

Php
asked May 17, 2023 at 17:55
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.