Req #68249 [NEW]: Implement another string delimiter as alternative to double quotes
| From: | work at web-sav dot de | Date: | Fri, 17 Oct 2014 07:48:07 +0000 |
| Subject: | Req #68249 [NEW]: Implement another string delimiter as alternative to double quotes | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-509@lists.php.net to get a copy of this message | ||
From: work at web-sav dot de
Operating system: Irrelevant
PHP version: Irrelevant
Package: PHP Language Specification
Bug Type: Feature/Change Request
Bug description:Implement another string delimiter as alternative to double quotes
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 bug report at https://bugs.php.net/bug.php?id=68249&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68249&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68249&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68249&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68249&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68249&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68249&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68249&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68249&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68249&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68249&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68249&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68249&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68249&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68249&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68249&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68249&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68249&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68249&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68249&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68249&r=mysqlcfg