Ways to write PHP scripts

Discussion in 'Webmaster Discussion' started by smsabbir480, Jul 5, 2014.

  1. smsabbir480

    smsabbir480 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.
    Php_p1_notepad.gif

    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
     
  2. zakir500

    zakir500 New Member

    Which is the best way to write it?
     
  3. lestforum

    lestforum New Member

    For this to work you have to save it as whatever.php if not it will show as plain text :)
     

Share This Page