FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » When do I use {}?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: When do I use {}? [message #169547 is a reply to message #169529] Fri, 17 September 2010 13:31 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 17/09/10 03:57, Marious Barrier wrote:
> Curly brakets just wrap code... if they are after a control statement...
> like an if, a do, a while, an each, a foreach, switch or others... they
> determine the code which is going to be executed when necessary.
>
> On 09/16/2010 10:13 PM, bruceaj wrote:
>> I have code samples where some variables are wrapped in {} (curly
>> brackets.) My problem is that I can find anything in the documentation
>> when they can be uses.
>>
>> Can someone tell me or point me to some documentation??

Perhaps he means:

echo "some string with a $array[member]\n";

vs:

echo "some string with a {$array['member']}\n";

I *think* you need to use {} if you want to stack a multiple dimensional
or nested array ref in an echo, eg:

echo "some string with a {$array['row']['column']['layer']}\n";

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OOP, classes and databases
Next Topic: @sessionstart()
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 09:04:34 GMT 2024

Total time taken to generate the page: 0.03859 seconds