11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 3 • <strong>PHP</strong> BASICSYou might assume that $animal is a variable and that \n is a newline character, and therefore bothshould be interpreted accordingly. However, what if you want to output the string exactly as it is written,or perhaps you want the newline to be rendered but want the variable to display in its literal form($animal), or vice versa? All of these variations are possible in <strong>PHP</strong>, depending on how the strings areenclosed and whether certain key characters are escaped through a predefined sequence. These topicsare the focus of this section.Double QuotesStrings enclosed in double quotes are the most commonly used in <strong>PHP</strong> scripts because they offer themost flexibility. This is because both variables and escape sequences will be parsed accordingly.Consider the following example:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!