PHP tip: omit ?> from PHP only files

Great tip from the Zend programmer’s Reference Guide: For files that contain only PHP code, the closing tag (”?>”) is never permitted..

This is useful as it prevents whitespace after the closing ?> from being accidentally added to the output. I always check PHP files for whitespace manually, but this technique solves that problem automatically. Great!

Published on 28 may 2008.

Leave a response

This is where you can leave your response. All fields are required but the e-mail address will not be published.