Edit report at https://bugs.php.net/bug.php?id=23241&edit=1

 ID:                 23241
 Comment by:         php dot net at thehiltons dot net
 Reported by:        kitdekat_yh at yahoo dot com
 Summary:            Perl's qq~~ and q~~ -> PHP?
 Status:             Not a bug
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   Win2K AdvSrv
 PHP Version:        4.3.2RC1
 Block user comment: N
 Private report:     N

 New Comment:

I would very much like to see this opened as an RFC. The end-of-discussion 
nature of the "This is not perl" comment is incredibly closed minded. Much of 
PHP's syntax is similar to Perl. It was adopted because it works. Not because 
someone was trying to copy Perl. This also works. If you start taking away the 
things in PHP which co-exist in Perl then you don't have a whole lot left.

That fact remains that a lack of qq or qq-like quoting is a huuuuge deterrent 
to 
anyone looking to php after building a career in Perl (that, a cluttered 
namespace, and messy regex wrappers, at least for me).

PHP (language A) is used all-the-damn-time for writing html (language B) with 
inline javascript (language C)... each nested in quotes of the other. Choosing 
your own quote character for the outer layer (PHP) is insanely useful for 
writing readable and easy to maintain code. To ignore that value and dismiss 
the 
idea simply because it has roots in Perl is ridiculous. Absolutely ridiculous. 
To do so without so much as a discussion is disrespectful at best, and easily 
interpreted as un-welcoming or even hostile to those who might be looking to 
make the transition from Perl.

Someone who is more involved with the project than I am - Please consider 
opening this as a formal RFC.

It wouldn't be the first time it was recognized that providing functionality 
which "Other web languages have similar syntax" for was a very good thing. 
(https://wiki.php.net/rfc/shortsyntaxforarrays)


Previous Comments:
------------------------------------------------------------------------
[2003-04-17 18:47:22] kitdekat_yh at yahoo dot com

fine.. its open-source, i'll implement it myself.
make it into a patch for all future releases...

thanks for the support.

------------------------------------------------------------------------
[2003-04-16 10:38:19] w...@php.net

PHP is not perl; we won't be implementing this syntax.

------------------------------------------------------------------------
[2003-04-16 10:07:55] kitdekat_yh at yahoo dot com

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 this bug report at https://bugs.php.net/bug.php?id=23241&edit=1

Reply via email to