In plain English: The PHP opening tag (<?php) should always be placed on the very first line of the file, starting at column 1.
Why it matters: If there is any whitespace, blank lines, or HTML output before <?php, PHP will immediately send headers and output to the browser. This can cause unexpected whitespace in JSON/API responses, “Headers already sent” warnings, or break redirects and cookies.
<?php
// There is an empty blank line before the opening tag!
echo "Hello World";
<?php
declare(strict_types=1);
namespace App;
echo "Hello World";
(Note: Shebang lines like #!/usr/bin/env php for CLI scripts are allowed on the very first line before <?php).
<?php or <?= is on line 1 of the file.#!...) lines in CLI scripts on line 1.<?php tag.E0001 has no configuration options and is enabled by default.
Always make <?php the absolute first characters in your PHP source files (unless writing a CLI script with a shebang). Never leave blank lines at the top of your files!