Skip to main content

Practical-1

Write a PHP program to display 'Hello World" Message on Screen.

Introduction

This is a simple PHP program that displays the string "Hello, World!" on the screen. This is a good program to start with because it is easy to understand and it demonstrates the basic syntax of PHP.

Code

pr1.php
<?php
echo "Hello, World!";
?>

Output

Hello, World!
Explanation

This program uses the echo statement to output a string of characters, in this case the string is "Hello, World!". The echo statement can be used to output any string of characters, as well as variables and HTML tags.

The <?php and ?> tags indicate the start and end of a PHP block. Anything between these tags is interpreted as PHP code.

Use of different algorithms

This is a simple program that does not use any algorithms. However, we will discuss some algorithms in the next tutorial.