----- Original Message ----- 
From: "noginn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 4:29 PM
Subject: [PHP] The <<< convension


> I have read a range of comments on php.net manual where people have
> mentioned this, along with it being in the 'print' functions page itself.
> I have tryed to use it in some context before but without success, I
> have always been getting an error on some sort.
>
> For example;
> <?php
> $text = <<<END
> This uses the "here document" syntax to output
> multiple lines with $variable interpolation. Note
> that the here document terminator must appear on a
> line with just a semicolon no extra whitespace!
> END;
>
> print $text;
> ?>
>
> I would get this error when running the above script.
>
> *Notice*: Undefined variable: variable in
> *C:\WWW\Apache2\htdocs\php\testprint.php* on line *4*
> This uses the "here document" syntax to output multiple lines with
> interpolation. Note that the here document terminator must appear on a
> line with just a semicolon no extra whitespace!
>
> I am a little confused at this point as I followed a comment on the
> manual which had not been corrected by anyone.
>
> I am running PHP 4.3.4
>
> -- 
> /* remember not to open virii please :) */
> if (!gotbrain("receiver")) {
> openattachment("coolprogram.exe.jpg.pif");
> }
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


It works fine on my set, I use it quite often:

    $announcements = <<<EndAnnouncements
    <p><b><u><font face="$fontface" size="$fontsize"
color="$fontcolor">Announcements</u></b></p>

    <!-- ANNOUNCMENTS GO HERE -->

    <li>There is also a problem report section where you can submit any
problem you are having.<br>

    <li>Soon, the timesheet will also be integrated into the portal, so you
will only need to log in once to access everything.</font>

    <!-- END ANNOUNCEMENTS -->
EndAnnouncements;


Just have to make sure the EndAnnouncements; is on it's own line, at the
very first position.

$announcements    =     <<<TEST
                          1     1

Those are the only spaces, no spaces between <<< and TEST


Hope this helps,
Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to