Answers for "catch and exception in php warning"

PHP
0

php catch exception

<?php
function inverse($x) {
    if (!$x) {
       throw new Exception('Division durch Null.');
    }
    return 1/$x;
}

try {
    echo inverse(5) . "\n";
    echo inverse(0) . "\n";
} catch (Exception $e) {
    echo 'Exception abgefangen: ',  $e->getMessage(), "\n";
}

// Ausführung fortsetzen
echo "Hallo Welt\n";
?>
Posted by: Guest on August-03-2020
0

catch warning php

<?php mysqli_connect_error() ?>
<?php error_reporting(E_ALL); ?>
Posted by: Guest on May-26-2021

Browse Popular Code Answers by Language