PHP die() function
This is used to display a message and exists from the current script. This method is equivalent to exit() function.
Syntax
die(message);
The message parameter is required. It accepts a string message only.
Example
<?php
if($access_permission){
echo 'Welcome to dashboard';
}
else{
die('Access Denied');
}
?>
If user have not permission set to access, it returns 'Access Denied' otherwise returns 'Welcome to dashboard'.
Related PHP Functions
PHP array_reverse() functionPHP array_diff() function
PHP array_key_exists() function
PHP array_push() function
PHP array_search() function
PHP class_exists() function
PHP curl_setopt() function
PHP dirname() function
PHP each() function
PHP explode() function
PHP file_exists() function
PHP function_exists() function
PHP getenv() function
PHP is_readable() function
PHP ksort() function
PHP mkdir() function
PHP ob_start() function
PHP parse_url() function
PHP str_repeat() function
PHP substr() function