Technology
 

Die

from PHPWiki - the free guide to PHP.

The title of this article should be die(), but due to technical restrictions, cannot contain parenthesis.

Equivalent to exit().

This function is a language construct.

Contents

[edit] Arguments

void die ({{{params}}})


void die ({{{params}}})


[edit] Argument Inclusion

(PHP 3, PHP 4, PHP 5)

[edit] Examples

[edit] Example 1:

<?php
$filename = '/path/to/sample_file';
$file = fopen($filename, 'r')
  or die("cannot open file ($filename)");
?> 

[edit] Output

Cannot open file sample_file

[edit] Example 2:

<?php
die('Output this sample error message.');
?>

[edit] Output

Output this sample error message.
For more details on this function, visit its entry in the php manual.