1

In a php form, does it matter about the quotation marks...which one is correct or does it matter. I am loading data from an oracle DB...

value='<?php echo htmlspecialchars($objResult["CITY"]); ?>'

or

value="<?php echo htmlspecialchars($objResult['CITY']); ?>"
Ronald
  • 557
  • 1
  • 9
  • 26
  • No, it's fine either way. Just take into account what might be in your values -- could it have an apostrophe, such as O'Brien. – aynber Oct 31 '16 at 16:12
  • It really depends in what the string is containing, some times using "." (dots) is helpful. – Antonios Tsimourtos Oct 31 '16 at 16:14
  • You might wanna consider using single-quotes for such things, as it will be easier in the long run, especially when you're using such variables within HTML-statements. Also, double quotes will always be interpreted in PHP as "evaluate" to see if there are variables inside that needs to be parsed, and is therefore a hair slower than single quotes (not noticeable before you get into the thousands). – junkfoodjunkie Oct 31 '16 at 16:15
  • I do keep single quotes, double quotes and & in the DB – Ronald Oct 31 '16 at 16:20
  • I VOTE SINGLE QUOTES!. Well for arrays, like $objResults['indice'] anyway, and double for plain HTML /non-PHP values="HTMLVALUE" eg; like you 2nd choice – Duane Lortie Oct 31 '16 at 16:45
  • 1
    Possible (!) duplicate: http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – Topological Sort Oct 31 '16 at 18:48

0 Answers0