PHP Classes

File: examples/testcatch.php

Recommend this page to a friend!
  Classes of Jorge Castro   DaoOne   examples/testcatch.php   Download  
File: examples/testcatch.php
Role: Example script
Content type: text/plain
Description: Example script
Class: DaoOne
Access MySQL databases using the MySQLi extension
Author: By
Last change:
Date: 4 years ago
Size: 321 bytes
 

Contents

Class file image Download
<?php

/**
 * @throws Exception
 */
function error1() {
    throw new
Exception("Error");
}

function
error2() {
   
trigger_error("some error",E_USER_ERROR);
}

try {
    @
error1();
} catch (
Exception $e) {
   
var_dump($e->getMessage());
}
try {
    @
error2();
} catch (
Exception $e) {
   
var_dump($e->getMessage());
}