Hello. I was thinking about a presence of escaped output operator in PHP
and found this feature request: https://bugs.php.net/bug.php?id=62574. I
think this is quite necessary feature. There are a lot of projects which is
written without templating engine, and there are frameworks without
built-in templating engine by default. All this projects require to write
the code. Usually it is rather simple to switch to new version of language,
but it is almost impossible to switch many and many templates on a
templating engine.

Most of output code is an output of properties of database entities, and
only in some cases it's needed to concatenate HTML into string and then
print it with unescaped output. Escaped output operator can be useful. Also
we output data not into the void and not into simple text file, but into
HTML-document which has a certain format (markup). Also this is logical -
to have both forms, escaped and unescaped.

I want to suggest the operator "<?~ $str ?>", which will automatically wrap
output in htmlspecialchars(). It is mentioned in the feature request above.
It is quite easy to type, and there is a small possibility to write "<?=
?>" instead.

In PHP 7 there are new operators and other changes. I think, new echo
operator also can be added. I can implement it myself.

Reply via email to