PHP try Mot-clé
Exemple
Utilisez une instruction try...catch pour gérer les exceptions :
<?php
try {
throw new Exception("Ceci est une exception");
} catch(Exception $e) {
echo $e->getMessage();
}
?> Définition et Utilisation
Le try est un mot-clé utilisé pour créer une instruction try...catch ou try...catch...finally .
Pages Associées
Le throw est un mot-clé.
Le catch est un mot-clé.
Le finally est un mot-clé.
Lisez-en plus sur try..catch.finally (Exceptions) dans notre Tutoriel sur les Exceptions PHP .