Re: New operator for htmlspecialchars

From: Date: Wed, 16 Jan 2013 02:21:59 +0000
Subject: Re: New operator for htmlspecialchars
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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)

« previous php.internals (#64988) next »