What is Exit() and Die() Function

Exit() :-

   exit — Output a message and terminate the current script


<?php
                $site = "http://www.google.com/";
                fopen($site,"r")
                or exit("Unable to connect to $site"); 
?>

Definition and Usage : 

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

This function is an alias of the die() function.

Syntax :- 
          exit(message);  ,

         exit ([string $status ] ); ,

        exit ( int $status );

                                      Die() :-

die — Equivalent to exit()



Description:
- This language construct is equivalent to exit(). 

<?php
                $site = "http://www.google.com/";
                fopen($site,"r")
                or die("Unable to connect to $site"); 
?>


This function is an alias of the exit() function.


Comments