PHP is a very popular scripting language and it is widely used in creating interactive websites. It shot to popularity primarily because of its interactivity within websites, ease of use and the integration of HTML.
However, behind the scene are many or even hundreds or thousands of PHP scripts that are written to control how a website would behave in various situations.
In this article, we are going to talk about how to write simple scripts to at least have a foundation.
The first thing to do is to open a text editor. Type in simple statement in it. Section of your code will start and end with PHP tags and they look like this: <?php ?>.
Simple Texts in PHP
“Echo” is a basic statement in PHP language. This is simply an instruction to your computer to output text to screen. The text you wanted to echo should be enclosed in quotation marks and must end with a semicolon.
It looks like this:
echo ‘Hello, World!’;
Save it anyway you want. For the sake of this article, let’s save it as Hello World, just make sure that it has a .php extension.
Output of Your Simple Program
You could actually check the PHP file using any web browser. After opening your browser and key this in to the address bar “file: http://localhost/hello world.php”. Your browser must recognize and read the echo statement and display it.