Installing PHP Tutorial
Installing PHP Tutorial
In PHP, creating a "Hello World" program is a simple and effective way to start coding. It allows you
to test that your environment is set up correctly and that PHP is functioning as expected.
<?php
echo "Hello, World!";
?>
Explanation:
<?php and ?> are PHP opening and closing tags respectively. All PHP code must be
placed between these tags.
echo is a PHP function used to output strings or variables. In this case, it outputs the
string "Hello, World!".
The semicolon ; is used to terminate statements in PHP.
Running the Program:
To run this PHP program:
1. Create a new file with a .php extension, for example, hello_world.php.
2. Copy the above code into the file.
3. Save the file.
4. Open a terminal or command prompt.
5. Navigate to the directory where you saved the file.
6. Run the following command:
Code:
php hello_world.php
Output:
Hello, World!