first-php-program

PHP Program: Make Your First PHP program.

Hello Friends,

In this blog post, I will let you know, how to make your first PHP program step by step?

This will be very beneficial to those aspirants who are very new to a programming language.

We will teach you this program at localhost using Xampp server as PHP requires a server to run.

Xampp server consists both an Apache server for running our code SQL database for storing our project data.

Netbeans is an IDE(Integrated Development Environment) which was primarily intended for Java but also supports languages like PHP, HTML, CSS, XML, JS, XHTML and etc..


What software is needed to make this PHP first program?

For making your very first program you should need the below-given software:

1. Install Net Beans software.
2. Install Xampp Server.


What is the procedure to make my first PHP program?

Once you installed both the software given above you can follow the below step by step procedure for making your first PHP program.

Open your NetBeans ID and click on file, and then click on a new project as shown the in the below image.

php1


Here select the PHP option and click on next button as shown in the below image.

php2


Give a suitable name to your project and then click on Finish button as shown in the below image.

php3


Your project has been created and now you can easily write your program. Here you can write both the code HTML as well as PHP code.

PHP code always written inside the <?PHP……?>

<?PHP – php opening tag
//Write PHP code
?> – PHP closing tag

Write your first PHP program, here you can also remove the HTML elements if not using any HMTL code. See the code below.

Echo: this keyword is used to print the statement on the screen.

php44


Now, you are ready to run your project, just start your Xampp server and start your Apache server as shown in the below image. In this project, we are not using a database so there is no need to start MySQL Server. See the below image for the same.

php6


Now, you can run your program: you just do the right click on the mouse and then click Run file as shown in the below image. You can also run the project by typing:

HTTP://localhost/projectname/index.php on the browser.

php5

 


This is the output of your program as shown in the below image.

php7


In a case of any queries, you can write us at anurag@a5theory.com we will get back to you ASAP.

Hope! you would have enjoyed this post.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!