Re: [RFC] New operator for context-dependent escaping
| From: | Michael Vostrikov | Date: | Sun, 17 Jul 2016 10:35:03 +0000 |
| Subject: | Re: [RFC] New operator for context-dependent escaping | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94527@lists.php.net to get a copy of this message | ||
>
> Multiple arguments would make the syntax even cleaner:
> <?* $str, 'js', 'html' ?>
>
I thought about it. Multiple arguments do not allow runtime modification
(and make the parser more complex).
Something like this:
<?php
$context = [];
if ($field->name == 'url') $context[] = 'url';
$context[] = 'html';
?>
<div data-my-attr="<?* $field->value, implode('|', $context)
?>"></div>