Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php without start/end tags?

Tags:

php

Is it possible to have php not to require the begin/end tags (<?php ?>) for some of the files? The code should be interpreted as php by default.

I'm aware that I can leave out the end tag (?>).

like image 449
vise Avatar asked Sep 06 '09 15:09

vise


1 Answers

It's better to not use end tag. Begin tag is neccesary.

As MaoTseTongue mentioned, in Zend documentation there is written:

For files that contain only PHP code, the closing tag ("?>") is never permitted. It is not required by PHP, and omitting it´ prevents the accidental injection of trailing white space into the response.
like image 99
Thinker Avatar answered Sep 18 '22 05:09

Thinker