Exception in PHP 8.0

$nullableValue = null;
try {
    $value = $nullableValue ?? throw new InvalidArgumentException();
} catch (InvalidArgumentException) { // Variable is optional
    // Handle my exception
    echo "print me!";
}
Comments