
PHP Tutorials
PHP (Hypertext Preprocessor) is a popular server-side scripting language used to create dynamic web pages. It is widely used in web development due to its simplicity, flexibility, and ease of integration with HTML and databases.
One of the first steps in learning PHP is understanding how to display output to the user. PHP provides basic commands like echo and print to output text, HTML, or other data. These commands are simple but fundamental, forming the building blocks for more complex PHP programs.
In this tutorial, we will start with the classic “Hello World” example, explore the difference between echo and print, and understand how PHP statements are structured.
<?php echo "Hello World";?>
Output: Hello World
Explanation:
A PHP script starts with <?php and ends with ?>
In PHP there are two basic ways to get the output: echo and print.
<?php print "Hello World";?>
Output: Hello World
What is difference between echo and print?
The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters while print can take one argument. echo is marginally faster than print.
“Hello world!” : is a string (sequence of characters).
Note: PHP statements end with a semicolon (;).
- END -



