CKTIS / PHP
Keyword die
This alias of exit terminates the entire script.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
die("finished");This alias of exit terminates the entire script. A string argument is printed and normally yields exit status zero. Shutdown callbacks still execute, while subsequent ordinary statements do not. PHP 8.4 permits using die as a callable with a first-class callable expression.
register_shutdown_function(fn()=>print(" closed")); $stop=die(...); $stop("done"); echo "later";
done closed
Examples
<?php
register_shutdown_function(fn()=>print(" closed")); $stop=die(...); $stop("done"); echo "later";
Result
done closed