The die() is an inbuilt function in PHP. It is used to print message and exit from the current php script. It is equivalent to exit() function in PHP.
Parameters : This function accepts only one parameter and which is not mandatory to be passed.
- $message : This parameter represents the message to printed while exiting from script.
Return Value : It has no return value but prints given message while exiting the script.
Input : die("code ends here") Output : code ends here Here, die() function ends the script with a message "code ends here "
Applicable versions :
This function is applicable in all PHP4 and later versions.
Unable to connect to given site.
The sleep() is an inbuilt function in PHP. It is used to delay the execution of the program for given amount of seconds.
int sleep(int $seconds)
Parameters : This function accepts only one parameter and which is mandatory to be passed.
- $seconds : This parameter represents the delay time in seconds.
Return Value : It returns zero on success, or FALSE on error. This function returns a non-zero value if the call was interrupted by a signal.
Errors / Exceptions : This function generates E_WARNING when the number of seconds is negative.
Applicable versions : This function is applicable in PHP 4, PHP 5, PHP 7.
Note that, Timing after halt (sleep) is 5 seconds more than timings before halt (sleep).
- jQuery | die() Method
- PHP | sleep( ) Function
- Prevent System from Entering Sleep mode in ElectronJS
- 'AND' vs '&&' as operator in PHP
- HTML & CSS | Tabindex attribute & Navigation bars
- Google Amp amp-ad
- Google AMP amp-accordion
- How to create Nested Accordion using Google AMP amp-accordion?
- How to create Hidden Header using Google AMP amp-accordion?
- How to create Dynamic Header using Google AMP amp-accordion?
- Google AMP amp-facebook-like
- Google AMP amp-carousel
- Google AMP amp-date-countdown
- Google AMP amp-brightcove
- Google AMP amp-bind-recaptcha
- Google AMP amp-autocomplete
- How to disable download option in amp-audio in Google AMP ?
- How to set custom media notification with amp-audio in Google AMP ?
- How to set an image placeholder for amp-anim in Google AMP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.