Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9881

Re: strange one

From Shelly <sheldonlg@thevillages.net>
Newsgroups comp.lang.php
Subject Re: strange one
Date 2013-06-24 21:18 -0400
Organization A noiseless patient Spider
Message-ID <kqaqr0$3ou$1@dont-email.me> (permalink)
References <kqaptj$vgn$1@dont-email.me> <S96yt.64696$hw2.28189@newsfe04.iad>

Show all headers | View raw


Thank you Lew and Scott.

On 24/06/2013 21:14, Lew Pitcher wrote:
> On Monday 24 June 2013 21:02, in comp.lang.php, sheldonlg@thevillages.net
> wrote:
>
>> My daughter also does php.  She has to fix up some awful code.  She came
>> across something that I have never seen before.  It goes something like
>> this:
>>
>> $a .= <<<BLAH;
>>
>> What is that <<<  ?
>   
>
> It is the start of a "heredoc"
> http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
>
> Specifically, the word immediately adjacent to the right of the <<< (in your
> case, the word BLAH) is taken as a sentinal, and all lines between the line
> containing the start of the heredoc (the <<<BLAH line) and the first line
> that contains the sentinal word are treated like a single string.
>
> Thus
>    <<<BLAH
> this is a test
> one two three
> four five
> six
> BLAH;
>
> is treated as a single string consisting of
>    "this is a test\none two three\nfourfive\nsix\n"
>


-- 
Shelly

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

strange one Shelly <sheldonlg@thevillages.net> - 2013-06-24 21:02 -0400
  Re: strange one Scott Johnson <noonehome@chalupasworld.com> - 2013-06-24 18:10 -0700
  Re: strange one Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-06-24 21:14 -0400
    Re: strange one Shelly <sheldonlg@thevillages.net> - 2013-06-24 21:18 -0400
    Re: strange one richard <noreply@example.com> - 2013-06-27 12:17 -0400

csiph-web