On Sat, Jul 11, 2009 at 13:26, Eddie Drapkin<oorza...@gmail.com> wrote:
> Uhm.... you don't need braces around arrays unless you're using more
> than one dimension in the array.
> This works perfectly fine for me:
> <?php
> $bar = array('hello' => "goodbye");
> $foo = <<<EOT
> $bar[hello]
> EOT;
> echo $foo;  //echos out goodbye
> ?>

    It works fine because you're forcing PHP to cast 'hello' in your
array from a simple boolean TRUE to the string equivalent.  Bad,
Eddie!  Stay off the couch!

> Something this simple should be common knowledge :X but I still agree
> with Daniel that you ought to use {} around variables in HEREDOC (or
> double-quotes) as it makes your code much more readable.

    It also works similar to the method in which double quotes
(translatable) work as opposed to single quotes (literal), though
instead of printing the literal $bar['hello'] it will give you a parse
error (T_ENCAPSED_AND_WHITESPACE, if memory serves correctly for once,
but don't quote me on that).

</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at

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

Reply via email to