A decorator pattern allows us to wrap something.
I have such a question.
Is there a solution (pattern, approach) in order to drive into the variable the code of the page, which is between certain "markers"?
Those. in essence, repeat the functionality of the Heredoc syntax, but not the built-in tool in php.
Something like this plan (preferably without OOP, but you can offer a small OOP solution):
beginBlock($variable); <h1>Example...</h1> <div><?= $needCount ? $object->countRows : '' ?></div> ... endBlock($variable); Just do not ask "Why?". Sometimes you need. For example, when inside the html block complex calculations, and dvizhek old and implemented functional programming (without OOP). Why is Heredoc not suitable? Sometimes it does not suit (gives some discomfort) due to some IDE or for other reasons.
Once again - do not try to make me a good coder. I perfectly use in the life of the PLO. There is just a question - you just need an answer. Without philosophy.
Even if there is no need - just interested to know.
If there are such solutions - hint with a link or an example.
Thank you in advance!