PHP ignore_user_abort() Function

Definition and Usage

ignore_user_abort() function sets whether the script execution will be terminated when disconnected from the client.

This function returns the previous value of user-abort setting (a boolean value).

Syntax

ignore_user_abort(setting)
Parameter Description
setting

Optional. If set to true, it will ignore the disconnection with the user, and if set to false, it will cause the script to stop running.

If this parameter is not set, the current setting will be returned.

Tips and Comments

Note:PHP will not detect if the user has disconnected until it tries to send information to the client. Simply using the echo statement cannot ensure that the information is sent, see flush() function.

Example

<?php
ignore_user_abort();
?>

Output:

0