#23241 [NEW]: Perl's qq~~ and q~~ -> PHP?
| From: | kitdekat_yh at yahoo dot com | Date: | Wed, 16 Apr 2003 15:07:55 +0000 |
| Subject: | #23241 [NEW]: Perl's qq~~ and q~~ -> PHP? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37752@lists.php.net to get a copy of this message | ||
From: kitdekat_yh at yahoo dot com
Operating system: Win2K AdvSrv
PHP version: 4.3.2RC1
PHP Bug Type: Feature/Change Request
Bug description: Perl's qq~~ and q~~ -> PHP?
Perl has the ability to 'inline' HereDocs by using qq~~ (double quoting)
and q~~ (single quoting) a portion of text exactly like a HereDoc does
(parsing $vars while keeping nopn-escaped "s and 's as well) without
taking up entire lines for start and end tags. Also the ~ symbol can be
replaced by any character( q// and qq//, etc) that you wont be using
within the string, and if you do, can be escaped to still print it out. It
also allows for multiple HereDoc conversions on a single line, examples as
follows:
echo <<< END_HERE1
remembers "quotes" and parses $vars
and 'remembers' new lines
END_HERE1;
echo join("\n", $array_list);
echo <<< END_HERE2
and continues.
END_HERE2;
can be done as follows:
echo qq~... "quotes" and $vars\n~ . join("\n", $array_list) . qq~and
...\n~;
which allows more condensed code and, atleast i think, makes creating
complex formatted HTML easier. This is not simply another alias btw (as
mentioned in #12779) but a varying functionality that increases the power
of PHP as seen in the examples. Since HereDocs do not do the q~~ (single
quote version) at all nor do they function with multiples 'inline'd
either.
I feel that this will alleviate many Perl convert's problems with
formatting their pages a specific way and allow them to write however they
need it written at the moment.
--
Edit bug report at http://bugs.php.net/?id=23241&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23241&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23241&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23241&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23241&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23241&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23241&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23241&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23241&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23241&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23241&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23241&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23241&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23241&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23241&r=gnused