amitmerchant1990 / amitmerchant-dot-com-comments

1 stars 0 forks source link

using-throw-as-an-expression-in-php8/ #20

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Using throw as an expression in PHP 8 – Amit Merchant – A blog on PHP, JavaScript and more

Up until now, when you want to throw exceptions from your code, you would use the throw keyword to throw the exception which can be caught by the catch block like so.

https://www.amitmerchant.com/using-throw-as-an-expression-in-php8/

kiatng commented 3 years ago

$_POST['param'] ?? throw new Exception('Missing post param!');