At 3:42 PM +0100 7/11/09, Ashley Sheridan wrote:
On Saturday 11 July 2009 15:23:55 tedd wrote:
 > At 8:34 PM -0400 7/10/09, Daniel Brown wrote:
 > >$html =<<<HTML
 ><b>File Name:</b> {$filedata['name']}<br />
 ><b>File Size:</b> {$filedata['size']}<br />
 > ><b>\$somevar</b>: {$somevar}<br />
 > >HTML;
 >echo $html;

 > Daniel:

 > Why the braces?
 > tedd

The braces ensure that PHP doesn't stop parsing the variable name once it
reaches the [. By default, it will only match a variable name up to the [
sign, so you couldn't access arrays without the braces.



Ahhh, the arrays -- I should have looked further up.

I just noticed:

   <b>\$somevar</b>: {$somevar}<br />

and wondered why, because:

   <b>\$somevar</b>: $somevar<br />

will work.

Side note: Paul Novitski showed me using an underscore for heredocs:

$html =<<<_

That I thought was kind of neat. To me it makes heredocs stand out and are more uniform.

In any event, thanks,



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to