aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/pear/text_languagedetect/docs/errorhandling.php
blob: b68e42476c8d4063d417f48723bf7940f92e9989 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                          
<?php
/**
 * How to handle errors
 */
require_once 'Text/LanguageDetect.php';
require_once 'Text/LanguageDetect/Exception.php';

try {
    $ld = new Text_LanguageDetect();
    $lang = $ld->detectSimple('Das ist ein kleiner Text');
    echo "Language is: $lang\n";
} catch (Text_LanguageDetect_Exception $e) {
    echo 'An error occured! Message: ' . $e . "\n";
}
?>