PHP Scripts – WordPress Tutorials

Basic Code in PHP

Before Writing your basic code in PHP, it is important to know about the PHP and it is also important to know what PHP can do?

If you are well familiar with that and ready to start coding with php, then I have some clean suggestions for you.

Open your IDE for PHP, if you are not having and IDE, don’t worry you can code in Notepad.

Now you have to insert the starting and ending tags of php. Each PHP script starts and end with special opening and closing tags. Commonly used style is below:

<?php   ?>

You can also code in ASP style, for ASP starting and ending tags are as <%  %>. The first thing is that you have to print a string. Write the following code and open it in your browser.

Printing a string


echo ‘My very First Code’; // it will Print out the string you entered


I am writing my code in Adobe Dreamweaver, You can use any of PHP editor.

Save your file as basic.php

Note that you have to save your file in your server folder(WWW or Htdocs). I have created a new folder with name “abc” at my server and saved my file as basic.php in that directory.

Open your browser and write down the address of your directory, in my example, i am on localhost and i have entered the following address:


where abc is the name of my directory and basic.php is the name of my file.

You will have the following output:

Random Posts

Categories: Web Development
  • lol

    if you’re going to write some php code, make sure the screen shot images don’t make it look like you have no clue how to code for the web.


    • Mudasir Nazir

      Is there something wrong with my Screen Shots?

  • Imran Korai

    That’s good to learn PHP basic.