Throughout your PHP career you will be using strings a great deal.
Therefore having a basic understanding of PHP strings is very important
A string can be used directly in a function or it can be stored in a variable.
In the two examples below, the same string was created twice:
First Example -- The string was stored in a variable and then echoed.
$my_string="PhpMyanmar.com-Unlock your potential!";
echo $my_string;
?>
Second Example -- The string was directly echoed.
echo "PhpMyanmar.com-Unlock your potential!";
?>
We have created strings using double-quotes up to now,? but it is just as correct to create a string using single-quotes, (apostrophes).
$my_string = 'PhpMyanmar.com - Unlock your potential!';
echo 'PhpMyanmar.com
- Unlock your potential!';
echo $my_string;
?>
If you want to use a single-quote within the string you have to escape the single-quote with a backslash \ . Like this: \' !
echo 'PhpMyanmar.com - It\'s super';
?>
Double-quotes should be used as?the primary method for forming strings.
Double-quotes allows many special escaped characters to be used that you cannot do with a single-quote string.
See below where backslashes are used to escape a character.
Escaped characters shown above are not very useful for outputting to a web page because HTML ignore extra white space( tab, newline, and carriage return are all examples of extra 'ignorable' white space)
But when writing to a file that may be read by human eyes these escaped characters are a valuable tool!
PHP has a very robust string creation tool called heredoc?
It lets the programmer create multi-line strings without using quotations.
Few very important things to follow when using heredoc.
Note
For more detail please see
Php Manual at http://www.php.net