note 125861 added to function.exit

From: Date: Fri, 26 Feb 2021 11:33:23 +0000
Subject: note 125861 added to function.exit
Groups: php.notes 
Request: Send a blank email to php-notes+get-219305@lists.php.net to get a copy of this message
it is also possible to include function calls e.g. logging function to write the error in a log file. e.g. function logerror($error){ file_put_contents(__DIR__.'/error_log', 'Error occured: '.$error'); } die(logerror('error msg here'); This will terminate the script and write "error msg here" to error.log You could use this for example when query the database to log when the query fails. ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.247 (proxied: 89.166.172.187) ---- Manual Page -- http://php.net/manual/en/function.exit.php Edit -- https://master.php.net/note/edit/125861 Del: integrated -- https://master.php.net/note/delete/125861/integrated Del: useless -- https://master.php.net/note/delete/125861/useless Del: bad code -- https://master.php.net/note/delete/125861/bad+code Del: spam -- https://master.php.net/note/delete/125861/spam Del: non-english -- https://master.php.net/note/delete/125861/non-english Del: in docs -- https://master.php.net/note/delete/125861/in+docs Del: other reasons-- https://master.php.net/note/delete/125861 Reject -- https://master.php.net/note/reject/125861 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#219305) next »