Re: New operator for htmlspecialchars
Hi!
> Hello,
>
> I created a small ticket to propose a shorter syntax for htmlspecialchars:
>
> old:
> <?= htmlspecialchars($str, ENT_QUOTES) ?>
Don't think operator can make sense here, since you can have different
options, etc. depending on context. But you could do this if the above
is too long for you:
function _h($str) {
return htmlspecialchars($str, ENT_QUOTES);
}
...
<?= _h($str); ?>
Not much longer than operator, much clearer and does not require
language syntax to be linked to some specific options in some specific
function.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
Thread (3 messages)