Ways to write PHP scripts

Not open for further replies.


New Member
PHP is a server scripting language used to make web pages interactive,dynamic. For example, think of what happens when you edit a page on this website. Behind this process are many, perhaps hundreds, of PHP scripts controlling how web pages change based on a variety of circumstances.This article will teach you how to write a few very simple PHP scripts so that you can get a basic understanding of how PHP works.Many CMS (content manage system) use PHP language that makes web developement so easy.If you want to write php scripts at first you have to install the PHP engine on your computer(Xampp,wamp,memp etc.).

.Method 1:Echo

a)Open Notepad. (File>>All Programs>>Accessories>>Notepad).

b)Then type (<?php echo “Hello World!”; ?>)c)Save this file as whatever name you want.

.When saving files in Windows Notepad, wrap the filename in double quotations so that Notepad doesn’t add .txt to the end of the filename. Notice in the image that the file hello world.php has ” ” around it. Without the quotation marks Notepad would have saved the file as hello world.php.txt

d)Alternatively, you can simply click the drop down menu under Save as type and change it to “All Files (*.*)” which will leave the name exactly how you type it and the quotes will not be needed.

If you receive an error message, make sure you typed the code correctly as shown above, including the colon.
5101 7b1.jpg
This is what you should see in your browser window:

Hello World!
5101 7b2.jpg

e)Open your favorite browser. Type this address in the address bar: http://localhost/hello world.php
Not open for further replies.
Award-winning Mac antivirus and Internet security software