Output:

This is an example in which a number is assigned to a variable, which is further displayed on the web browser.
| Example |
<html> |
<head> |
<title>Example</title> |
</head> |
<body> |
|
<?php |
$txt=56; |
echo $txt; |
?> |
|
</body> |
</html> |
| |
| |
Output:

In order to concatenate two or more variables together while displaying the result on screen, use the dot (.) operator.
| Example |
<html> |
<head> |
<title>Example</title> |
</head> |
<body> |
|
<?php |
$abc="Welcome to expertrating!"; |
$xyz=56; |
echo $abc . " " . $xyz; |
?> |
|
</body> |
</html> |
| |
| |
Output:

Comments
In PHP, if a single line comment has to be made we use two backslashes //. If a double line or large comment block has to be made then it has to start with a /* and end with a */.
| Example |
<html> |
<body> |
|
<?php |
//This is a comment |
/* |
This is |
a comment |
block |
*/ |
echo "You have Learned about Comments."; |
?> |
|
</body> |
</html> |
| |
| |
Output:

|