Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Different ways to define Strings in PHP.

PHP Articles

☯ All PHP Articles     ☯ All Articles


A new product.






Popular Google Pages:




This article is regarding
Different ways to define Strings in PHP.
Last updated on: .



◕ Different ways to define Strings in PHP.
We can define Strings in our programs in three different ways.

These are: Single quotes, Double quotes, Here Document.

Examples are given below:

1) Single quotes
Example:
echo 'We are Indian.';
echo '<h1>We are Indian.</h1>';

2) Double quotes
Example:
echo "We are Indian.";
echo '"We are Indian," he said.';
echo "<h1>We are Indian.</h1>";

■ 3) ▻ Here Document
Example:
echo <<<HTMLBLOCK
<html>
<head><title>php</title></head>
<body>
<h1>This is PHP.</h1>
</body>
</html>
HTMLBLOCK;



What is Here Document?
Difference between Single quoted & Double quoted String?



Related articles:
Difference between Single quoted string & Double quoted string
Different way to define string in PHP?
What is Here Document in PHP?
What is PHP?
How Browser communicates with Server?
How PHP Works?
How to use PHP inside HTML?





Popular Google Pages:





Top of the page

Amazon & Flipkart Special Products

   


Top of the page