<?Php
echo "Hello World";
?>
To learn more on this let us try to print the value of a PHP variable. To start with let us print today's date by using one variable.
<?Php
$date= date("m/d/y");
echo "Today is $date";
?>
Some time we may require to print the name of the variable than printing the data. So here we will use escape character ( \ ) before the $ symbol to tell PHP that consider the next character as string and not as a variable.
<?Php
$date= date("m/d/y");
echo "Today is $date, this value was stored inside variable \$date";
?>
<?Php echo $value; ?>
We can also use escape character ( \ ) to print double quotes to the screen by using echo command. Here is an example.
<?Php
echo "John said \"He is learning PHP \" by reading ";
?>
Output is here
John said "He is learning PHP " by reading
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.
Dan Land | 27-02-2010 |
Your tutorial is helpful and most appreciated. I've learned a lot |