By Stephon Unomon
In PHP, as a general rule, a String is any line of text
contained within quotation marks. You can use either double quotation marks (“)
or single quotation marks also known as apostrophes (‘) in a string. Strings
could be considered the building blocks of PHP, considering most all data is
going to come from what’s in a string.
<?php
$double = "quotation marks.";
$single = 'single quotes.';
?>
When using single quotes, you need to “escape” the
apostrophe with the slash (just like you would with double quotation marks) if
you wish to display it in the output text...
<?php
echo 'Wouldn\'t you like a bagel?';
?>
Special commands
within strings...
There are some “secret commands” you can use within strings
to manipulate the output text:
\n: makes a new line
\r: a carriage return
\t: a tab
Kool PHP Suite - PHP User Interface Tools & Components
No comments:
Post a Comment