Skip to main content

"Hello World" program - Using PHP and NetBeans IDE 8.1


Notice: This might not be different in the newest versions of NetBeans
The aim of this tutorial is to show you how to write a "Hello World" program in PHP, and we'll be using the NetBeans IDE 8.1. If  you are new to PHP, then I bet this will be of help to you.  Enjoy!


Basic software requirements
1. NetBeans IDE: I'll be using version 8.1, you can download from here.
2. WampServer: Download from here.
3. A browser: You can use any browser of your choice

Step 1: Open NetBeans
Open NetBeans
Step 2: Goto File >> New Project or simply press Crtl+Shift+N. Under "Categories" by the left of the window, select "PHP". Then under "Projects" select "PHP Application".
Now click "Next >" .















Step 3: Give the project a project name of your choice, I'll use "Hello_World" (avoid white spaces).
Note: For the Source Folder, browse and search for the "www" directory in the "wamp" folder in the C drive and click Open. Type the name of the project again after the C:\wamp\www\ .
Click on "Finish".
Name project and put in "www" directory
You will see the newly created project in the "Projects" window.
By default, the index.php file is created. We will be using that file.

Created project

Step 4: Inside the PHP block (<?php  ?>), type:
                echo "Hello World";
The Run the file. You should see Hello World on your browser. 

Hello World in browser
You can also try the codes below to give us the same result:

1.    print_r("Hello World");

2. echo "Hello". "World";

3.  $welcome = "Hello World";
       echo $welcome;

4.  $greeting = "Hello"; 
       echo $greeting."World";

Hope you got it. Thanks!

Comments

Popular posts from this blog

Can I use Mendeley with LibreOffice Writer (on Windows)?

The answer is a big yes! Mendeley works with Microsoft Word as well as LibreOffice Writer. As you may know, LibreOffice is a free and open source software suite and can be downloaded from here . To get Mendeley, download from here . Having installed the two software, do the following: 1: Open Mendeley, go to Tools → Install LibreOffice Plugin 2 : Open LibreOffice Writer. You should see the newly added Mendeley tools just below the menus (as seen below). And that does it!

PHP Database Connection using NetBeans IDE 8.1 with WampServer

The aim of this tutorial is to show you how to use PHP in connecting to a MySql Database using the NetBeans IDE 8.1. Have it in mind that there are several ways of doing this but we'll be looking at just one - a basic one.

Working with PHP in NetBeans 8.1 using WampServer

The aim of this tutorial is simple to show you how to work with PHP using WampServer with the NetBeans IDE 8.1