05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table 4-1. Escape sequences in double-quoted strings<br />

Escape sequence Character represented<br />

\" Double quotes<br />

\n Newline<br />

\r Carriage return<br />

\t Tab<br />

\\ Backslash<br />

\$ Dollar sign<br />

\{ Left brace<br />

\} Right brace<br />

\[ Left bracket<br />

\] Right bracket<br />

\0 through \777 ASCII character represented by octal value<br />

\x0 through \xFF ASCII character represented by hex value<br />

If an unknown escape sequence (i.e., a backslash followed by a character that is not<br />

one of those in Table 4-1) is found in a double-quoted string literal, it is ignored (if<br />

you have the warning level E_NOTICE set, a warning is generated for such unknown<br />

escape sequences):<br />

$str = "What is \c this?"; // unknown escape sequence<br />

echo $str ;<br />

What is \c this?<br />

Here Documents<br />

You can easily put multiline strings into your program with a heredoc, as follows:<br />

$clerihew =

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

Saved successfully!

Ooh no, something went wrong!