note 129935 added to language.types.never

From: Date: Mon, 30 Dec 2024 16:08:18 +0000
Subject: note 129935 added to language.types.never
Groups: php.notes 
Request: Send a blank email to php-notes+get-221746@lists.php.net to get a copy of this message
While an infinite loop never terminates on its own, an "exit" statement halts the script's execution entirely. In contrast, an exception can be caught, allowing the script to continue executing. <?php function boom(): never { throw new BadFunctionCallException("Don't call me!"); } try { boom(); } catch (BadFunctionCallException) {} echo "Continue the script..."; ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 84.55.60.33) ---- Manual Page -- https://php.net/manual/en/language.types.never.php Edit -- https://main.php.net/note/edit/129935 Del: integrated -- https://main.php.net/note/delete/129935/integrated Del: useless -- https://main.php.net/note/delete/129935/useless Del: bad code -- https://main.php.net/note/delete/129935/bad+code Del: spam -- https://main.php.net/note/delete/129935/spam Del: non-english -- https://main.php.net/note/delete/129935/non-english Del: in docs -- https://main.php.net/note/delete/129935/in+docs Del: other reasons-- https://main.php.net/note/delete/129935 Reject -- https://main.php.net/note/reject/129935 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221746) next »