try {
throw new Exception("boom");
} catch (Exception $e) {
echo "caught: " . $e->getMessage();
}Ne yazdırılır?
- acaught: boom✓
- bboom
- cFatal error: uncaught exception
- dHiçbir şey yazdırılmaz
Açıklama:Fırlatılan Exception'ın mesajı "boom"'dur. catch bloğu Exception ile eşleşir ve sabit önek ile getMessage()'ı birleştirerek "caught: boom" yazdırır.