PHP VERSION: 8.2.18

throwable_interface_parse_error.php

<?php
// throwable interface: ParseError

$code 'This is not going to work';
try {
    
$result = eval($code);
    
var_dump($result);
} catch (
\ParseError $error) {
    
// Handle $error
    
echo 'Sorry ... parse error';
}
echo 
PHP_EOL;

Output


Sorry ... parse error
SOURCE CODE