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.

CHAPTER 3 • <strong>PHP</strong> BASICSwww.it-ebooks.infoTable 3-14. Recognized Escape SequencesSequenceDescription\n Newline character\r Carriage return\t Horizontal tab\\ Backslash\$ Dollar sign\" Double quote\[0-7]{1,3} Octal notation\x[0-9A-Fa-f]{1,2}Hexadecimal notationSingle QuotesEnclosing a string within single quotes is useful when the string should be interpreted exactly as stated.This means that both variables and escape sequences will not be interpreted when the string is parsed.For example, consider the following single-quoted string:print 'This string will $print exactly as it\'s \n declared.';This produces the following:This string will $print exactly as it's \n declared.Note that the single quote located in it's was escaped. Omitting the backslash escape character willresult in a syntax error. Consider another example:print 'This is another string.\\';This produces the following:This is another string.\In this example, the backslash appearing at the conclusion of the string has to be escaped;otherwise, the <strong>PHP</strong> parser would understand that the trailing single quote was to be escaped. However, ifthe backslash were to appear anywhere else within the string, there would be no need to escape it.76

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

Saved successfully!

Ooh no, something went wrong!