4 ms·
Me neither, I'd be interested in the use case for that many. A few years ago I made a PHP-based template system that had one nested buffer to have a poor-man's
by Jach 15y ago
Me neither, I'd be interested in the use case for that many. A few years ago I made a PHP-based template system that had one nested buffer to have a poor-man's eval of template (HTML with display-logic PHP) files, it just boiled down to:
ob_start();
include $file;
$contents = ob_get_contents();
ob_end_clean();
- lox 15y agoYup, this is common. If you put this in a function and use extract you can create a clean working space for a template where you can use $vars without worrying about polluting scope. I'd assume the 16x calls would be because they have a very complicated set of templates/layouts/partials, all doing their own templating.
- Jach 15y agoThat's actually exactly what I was doing in the full context. I can see 16 calls over the lifetime of the request, but what was confusing me was how they could have 16 nested calls forming some ob_start();ob_start();...ob_end_flush(); Maybe some crazy way to avoid having to return text up the tree through function returns. But I read the post again and it said nothing about nesting them, so it's probably just something like 16 sub-templates or whatever as you suggest being processed at different intervals, not necessarily nested, with the gc not collecting frequently enough.
- ars 15y ago> with the gc not collecting frequently enough. PHP is written in C which is not garbage collected. PHP itself collects garbage, but this buffer is an internal C buffer and would be released immediately.
- Jach 15y ago...Yeah, not sure what I was thinking with that one, thanks for replying. (My excuse! I've been up over 24 hours already...)