3 ms·
so, just choosing a random file off github, is this a template? https://github.com/symfony/Process/blob/master/PhpProcess.php https://github.com/symfony/Proces
by lacksconfidence 13y ago
so, just choosing a random file off github, is this a template?
https://github.com/symfony/Process/blob/master/PhpProcess.php https://github.com/symfony/Process/blob/master/PhpProcess.ph...
Or in other words, php files are only templates if you use them that way.
- Joeboy 13y agoIf I have, say, a jinja2 template that only contains logic and outputs nothing, is it a template? I would say it is. By which reasoning, yes that php file is also a template. Even if you've got used to pretending it isn't. Having said which, I'm confused by the lack of a closing ?>. Maybe PHP's parser lets you get away with that though.
- krapp 13y agoHaving said which, I'm confused by the lack of a closing ?>. Maybe PHP's parser lets you get away with that though. It's completely optional.
- vec 13y ago...and best practice is to omit it. Since PHP is a templating language any whitespace (other than a single newline) that comes after the ?> will be printed directly to stdout when the file is parsed, which is almost never what the author intends. Letting the parser insert it for you avoids this class of bugs.