die() function in PHP

The die() function prints a message and exits the current script.

Syntax

die(msg)

Parameters

  • msg − The message to write before exiting the script.

Return

The die() function returns nothing.

Example

Output

The following is the output.

Can’t connect!
Updated on: 2020-06-27T08:57:19+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements