Writing a simple Hello World script

Writing a simple Hello World script

How to create a script with the text name “Hello World” in PHP web development script.

Writing a simple Hello World script

You can follow the following steps to create a simple hello world script in php.

Step 1. First, create a PHP file.

Here first of all you have to create a new file with .php extension, for example, firstfile.php file.

Step 2. Write the PHP program source code script.

Now in this created file with .php extension, create the program source code given below.

<?php

// let create a simple hello world PHP script text on screen

echo “Hello, World”;

echo “\n”;

echo “Welcome to, the vcanhelpsu”;

?>

Explanation of Hello World Program.

  • <?php and ?> – These are the start and finish tags in PHP web development script. PHP script source code is written in these start and end tags.
  • echo – Echo is a built-in statement in PHP language, the PHP program source code is previewed in the console screen in digital format by echo statement in the web browser as text or data information. Here the echo statement outputs or displays the text string “Hello, World” and “Welcome to, the vcanhelpsu” in the console screen in this condition.

Step 3. Running the php script code.

At present, you can run the PHP script code in both online and offline mode, if you are running the PHP script code on your computer in a local computer, then to run the PHP script code, your desktop or laptop computer must have a local web server such as, XAMPP, MAMP, or WAMP or a PHP built-in server installed.

Store the firstfile.php file in the root directory of your web server. For example, for XAMPP it is htdocs, etc.

Now open any web browser on your computer and go to http://localhost/firstfile.php and type “Hello, World!” and “Welcome to, the vcanhelpsu” and see the output on the console screen.

Leave a Reply