How can syntax errors in PHP be displayed when using arrays with incorrect syntax?

When using arrays with incorrect syntax in PHP, syntax errors can be displayed by enabling error reporting in your PHP script. This can be done by setting the error_reporting level to E_ALL and displaying errors using ini_set('display_errors', 1). This will help you identify the specific syntax error in your array and correct it accordingly.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Incorrect array syntax
$array = [1, 2, 3 4];

// This will display a syntax error message
?>