Req #68249 [Opn->Sus]: Implement another string delimiter as alternative to double quotes
| From: | stas@php.net | Date: | Sat, 05 Aug 2017 04:55:07 +0000 |
| Subject: | Req #68249 [Opn->Sus]: Implement another string delimiter as alternative to double quotes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210519@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68249&edit=1
ID: 68249
Updated by: stas@php.net
Reported by: work at web-sav dot de
Summary: Implement another string delimiter as alternative to
double quotes
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to
the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals
list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the
Internals list (http://php.net/mailing-lists.php) and/or solicit help from one of the experienced
developers.
Please to not consider this comment as a negative view on the merits of your proposal - every
proposal which requires changes of certain magnitude, even the very successful and widely supported
ones, must be done through the RFC process. This helps make the process predictable, transparent and
accessible to all developers.
Previous Comments:
------------------------------------------------------------------------
[2015-08-08 14:14:50] cmb@php.net
FWIW, you can also do
$html = sprintf('<a href="%s">%s</a>', $url, $label);
------------------------------------------------------------------------
[2014-10-17 07:48:06] work at web-sav dot de
Description:
------------
How to merge together HTML/JS/SQL and PHP inside non-view scripts:
// looks messy
$htmlSingle = '<a href="' . {$url} . '">' . {$label} .
'</a>';
// good, but needs to be escaped
$htmlDouble = "<a href=\"{$url}\">{$label}</a>;
// breaks code clearity (especially inside classes)
$htmlHeredoc = <<<HTML
<a href="{$url}">{$label}</a>
HTML;
None of the above solutions are really perfect for solving one of the most common task in PHP. So a
mixture of the heredoc syntax (code injection for phpstorm) and the double quotes (one liners) would
be perfect imo. Maybe something like this:
// without code injection feature
$html = :|<a href="{url}">{$label}</a>|;
// with code injection
$html = :HTML|<a href="{url}">{$label}</a>|;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68249&edit=1