Jump to content


What's the deal with curly braces around variables

  • Please log in to reply
1 reply to this topic

#1 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 14 September 2006 - 08:08 PM

I see quite a lot of code on these forums that does the same thing but is written differently...

e.g. When referencing a GET variable in PHP I use $_GET['name'].  If I try and use this exact var in a heredoc it doesn't work, I have to drop the single quotes and use $_GET[name], now I've also seen people put it as {$_GET['name']}.

Now I can't find anything about these curly braces in the manual and I'd like to try and work to some kind of a standard, so does anyone have an explanation or can you point me to the page in the manual where it's listed?

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 14 September 2006 - 08:14 PM

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users