php exit
snippet in php

php quit

user9358

exit();		// Normal exit

exit(1);	// Exit with an error code

exit('Error!');	// Exit and print an error message

php stop execution

user2860

<?php 
//declaring variables 
$a=5; 
$b=5.0; 
  
if($a==$b) 
 { 
    //terminating script with a message using exit() 
    exit('variables are equal'); 
 } 
else
 { 
   //terminating script with a message using exit() 
    exit('variables are not equal');  
 } 
?> 

exit and echo php

user4919

//exit — Output a message and terminate the current script
<?php

$filename = '/path/to/data-file';
$file = fopen($filename, 'r')
    or exit("unable to open file ($filename)");

?>