Difference between Single Quote and Double Quote PHP

Difference between Single Quote and Double Quote PHP

Difference between Single Quote and Double Quote PHP

Normally when we Program PHP , sometimes Programmer were  confuse about the difference between Single Quote or Double Quote. In this Article , we will look into the Differences between a Single Quote and Double Quote PHP


<?php

$myname='Brian';

echo 'My name is $myname';

echo "My name is $myname";

?>

So as you can see the First Echo i used a Single Quote, and the second Echo i use a double quote.

Let see what is the result referring the picture below.

Difference between Single Quote and Double Quote PHP

Well as you can see the Single quote treat the Variable ” myname” as a string , while the Double quote render out the Variable Value.

Rendering out a Double Quote


<?php
$renderquote = <<<END

"My Name " is  "Brian " END;


echo $renderquote ;

?>

Results

Difference between Single Quote and Double Quote PHP

So with this Command you can render out any Symbol or Double quote.

 

 

 

Check out Accessing Server information with PHP

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + eight =