Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> there's no way to establish an interface between the caller and the callee without using functions

Um. Can you give me an example to pad that out a bit?

> and requires you to do cleanup after each template instantiation to avoid leaking values between templates

In my render() example, isn't that "reaching the end of the function"? (Edit: Wait, you're only talking about the superglobals, right?)



> Um. Can you give me an example to pad that out a bit?

Your example of using a render() function is already an example of this. You can parameterize render() to provide data to the template from the caller without utilizing untyped globals, and without having to clean the globals up after the template has rendered.

> Wait, you're only talking about the superglobals, right?

Yes. Globals are globals. PHP's super global distinction isn't really relevant to whether you are tainting the execution environment when you pass data to a script.

The point is, as I elaborate elsewhere, PHP is very awkward to use as a proper templating system.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: