What is die in PHP

In this article I am going to explain about PHP die function.
  • 2211

PHP error handling with die() function

You can explicitly handle error by in-built die function in PHP.

Syntax of die function

die("some text");

Example of  die function

<html>

<body>

<?php

if(!file_exists("abc.txt"))

  {

  die("The file is not available !");

  }

else

  {

  $file=fopen("abc.txt","r");

  }

?>

<body>
<head>


Output:

die function.jpg

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.