Forum Moderators: coopster

Message Too Old, No Replies

$ POST["tags"] or $ POST['tags']?

which is better and why?

         

kkonline

4:42 am on Sep 1, 2007 (gmt 0)

10+ Year Member



What is the difference if i write
$_POST["tags"]
and
$_POST['tags']
?
which is better or which is preferred?

dreamcatcher

6:10 am on Sep 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP will generally try to evaluate what's between the double quotes - very minor issue but best practice is to use single quotes.

dc

vincevincevince

6:32 am on Sep 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unless you're talking high load high performance code, it really doesn't matter. I tend to just write $_POST[tags] and have that level of warning turned off.

LBmtb

12:35 am on Sep 2, 2007 (gmt 0)

10+ Year Member



I'm with dreamcatcher. I try and use single quotes wherever possible.

eelixduppy

10:56 pm on Sep 2, 2007 (gmt 0)



>> I tend to just write $_POST[tags] and have that level of warning turned off.

Although it only throws a warning and is correctly interpreted this shouldn't be done this way. If you "just happen" to define a constant "tags" it will create a bigger error. Use quotes always; single ones are easier to type :)