die

die -- Output a message and terminate the current script.

Description

void die(string message);

This language construct outputs a message and terminates parsing of the script. It does not return.

Example 1. die example

  1 
  2 <?php
  3 $filename = '/path/to/data-file';
  4 $file = fopen ($filename, 'r')
  5     or die("unable to open file ($filename)");
  6 ?>
  7