String is the collection of characters which is stored in a single variable. PHP provides many in-built functions to use strings.
We need to enclose the string within double quote or single quote. We can store any string value into a variable or we can print the value directly instead, depends upon the need.
We can use both single and double quote for string creation. Now php introduces more robust technique called heredoc method to create string of multiple line.
echo'This is the first string within single quote<br/>';
echo"This is the second string within double quote<br/>";
$string="Value from string variable";
This is a multiple line string
using heredoc method.
This is the first string within single quote
This is the second string within double quote
Put some value to string variable
This is a multiple line string using heredoc method.
Liked it! Share this Tutorial