How can error reporting levels be adjusted in PHP to catch mistakes like using $_GET[jahr] instead of $_GET['jahr']?

When using PHP, errors like using $_GET[jahr] instead of $_GET['jahr'] can be caught by adjusting the error reporting level to include notices. This will make PHP show notices for potential issues like accessing an array key without quotes. By setting the error reporting level to include notices, developers can easily spot and fix these kinds of mistakes in their code.

// Adjust error reporting level to include notices
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Accessing $_GET['jahr'] correctly
$year = $_GET['jahr'];