Jump to content

Maybe a dum question


dhimok

Recommended Posts

Hello, my question is.

 

Where and when can I use { } to surround a variable? Like {$var} I know I can use it if echoing with

 

echo "{$var}";

 

I was mostly wondering how I can use it on include pages if I use ob_get_contents

Thanks

Link to comment
Share on other sites

using those braces are not required in some reading ive done i found out that the braces on the variables makes the php read it fast and for some programmer ive ask they told me like it makes the code error free.

 

but the explanation i accepted is that it makes the reading of variables fast.

 

you can use those braces any time with your variables

Link to comment
Share on other sites

Its all personal opinion. Braces need only really be used when you are using complex variables (arrays) within a double quoted strings.

 

Personally, id'e rather not use concatination, so I'm always using the {} curlys.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.