Re: mail problem (newlines becomes =0A)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Brown wrote:
    Forwarded.

    Accidentally clicked "reply" directly to Nitsan.  Sorry about that.  :-\

On Thu, Jun 19, 2008 at 2:47 AM, Nitsan Bin-Nun <nitsanbn@xxxxxxxxx> wrote:
Umm just for general knowledge, whats the difference between HEREDOC to
simple "<value>" assignment?
As far as i know they both do the same job except that HEREDOC have problems
with tabs infront of it (at the first line). Ther are other distinctions?

   HEREDOC syntax has no problems with tabs anywhere except the
termination mark.  For example:

<?php
$text =<<<EOT

   I can have tabs here, no problem.

EOT; // I can't have a tab before this terminator though.
?>

   About the only *real* problem you'll face with HEREDOC vs.
multiline quotes is using name-keyed arrays and superglobals.  For
example, you can use $foo[0], but you can't use $foo['bar'] or
$_SESSION['foobar'].

umm.... If this didn't work, most of my HEREDOC sections would not work.

AFAIK I have always been able to use name-keyed arrays in my HEREDOC.

I have always wrapped them with {...} to allow PHP to better identify them, but they have always worked for me.

<plaintext><?php

$a = array();

$a[0]['first'] = 'jim';
$a[0]['last']  = 'lucas';

$a[1]['first'] = 'daniel';
$a[1]['last']  = 'brown';

foreach ( $a AS $person ) {
	echo <<<OUT

Your first name is {$person['first']}.

Your last name is {$person['last']}.

OUT;
}

?>



--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.





--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux