What is the equivalent of a 'try' block in PHP compared to languages like C++ or Java?

In PHP, the equivalent of a 'try' block in languages like C++ or Java is the 'try-catch' block. This block allows you to attempt a piece of code that may throw an exception, and catch and handle any exceptions that are thrown within the block.

try {
    // Code that may throw an exception
    $result = 10 / 0;
} catch (Exception $e) {
    // Handle the exception
    echo 'An error occurred: ' . $e->getMessage();
}