Re: [PHP4BETA] Re: [PHP3] multilined string assignment like perl's <<END syntax ?
| From: | Bewotec Customer Support | Date: | Wed, 16 Feb 2000 16:33:40 +0000 |
| Subject: | Re: [PHP4BETA] Re: [PHP3] multilined string assignment like perl's <<END syntax ? | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10362@lists.php.net to get a copy of this message | ||
(SMPT server seems f**ked up, hope this gets through.)
Doh! I've just read the notes at the bottom of the manual
page:
herouth at zend.com
08-Feb-2000 01:22
About that little Heredoc problem, it's quite simple. The doc is wrong,
you have to reverse the ">" signs.
And true, you have to flush it to the left.
$str = <<< EOD
this is the first line
this is the second
but they both had four spaces in front
EOD;
Works fine.
At 05:10 PM 2/16/00 +0100, Cynic wrote the following:
Hm, I've just tried that (copy&paste from
the manual), and
ended up with a parse error on the $str = >>>EOD line.
I have a question for developers: is there a newer build of
PHP4 than the b3? pre-beta4 php.exe fails with a msgbox
saying "The procedure entry point php-ini-path could not be
located in the dynamic link library php4ts.dll" followed by
an "Internal server error" in the browser. (Yes, I've tried
both b3 and pre-b4 php4ts.dlls.) I'm not a programmer, don't
want to compile anything. Just working binaries for win32
env, please.
At 10:53 AM 2/16/00 -0500, Greg Wallis wrote the following:
Thanks for the link, cynic.
Do here docs work for you, and if so, what version of php are you
running?
I'm running 4.03b and the parser does not recognise the >>>
syntax.
Greg
----- Original Message -----
From: Cynic <cynic@mail.cz>
To: Greg Wallis <greg@practicalsoftware.net>
Sent: Wednesday, February 16, 2000 10:29 AM
Subject: Re: [PHP3] multilined string assignment like perl's <<END
syntax ?
> yes.
>
>
http://www.php.net/manual/language.types.string.php3
>
> At 10:16 AM 2/16/00 -0500, Greg Wallis wrote the following:
>
> Hi,
>
> I've got several lines of html that I need to assign to
a variable.
> Conventional assignment is a bit of a pain in this case,
because there
are
> so many lines.
>
> Perl offers a nice solution where you can use a
<<END operator. (I
think
> they call it "here documents")
>
> EXAMPLE:
> $s = <<END;
> line1
> line2
> line3
> END
>
> In perl, this assigns everything up to END to $s.
>
> Is there something similar in PHP ?
>
> ____________________________________________________________
> Cynic:
>
> A member of a group of ancient Greek philosophers who taught
> that virtue constitutes happiness and that self control is
> the essential part of virtue.
>
>
mailto:cynic@mail.cz
> ICQ: 2808 2505
>
>
>
>
>
>
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
mailto:cynic@mail.cz
ICQ: 2808 2505
-- PHP 4.0 Beta Mailing List To unsubscribe, e-mail:
php4beta-unsubscribe@lists.php.net For additional commands, e-mail:
php4beta-help@lists.php.net To contact the list administrators, e-mail:
php4beta-admin@lists.php.net
=========================
| Roman Neuhauser
| podpora zakazniku
|
| Bewotec, spol. s r. o.
| Kamenicka 26
| 170 00 Praha 7
|
| tel: 02/33 37 11 05
| fax: 02/33 37 10 96