PHP Using PHP with MySQL Querying the Database with PHP Avoiding Duplication

Why is there no closing php tag in database.php?

Why is there no closing php tag in database.php? In database.php, only <?php is there but not the closing tag, ?>.

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Chi;

Here is the quote from the PHP Manual

If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.

Ken

Thanks for the quick response!