Welcome to PHP training

1. Get yourself an editor - one that promises it'll make it easy for you to code in PHP. The main beneifit I find is they 'highlight' the code so make it easier to read/fault find. Once your IDE (Integrated Development Environment)/Editor is setup - the basic layout of a PHP file is the same as an HTML file: Title here!

2. Overview

  1. All PHP code must be within brackets
  2. All PHP files must end with extension .php
  3. Any html code must be within "
    hello
    "; with the semi colon at the end. V important.
  4. Variables must start with $ sign.

3. Let's test your system with the classic 'hello world' file

preparation

  1. Create yourself a folder on your server for playing around with. I'll call it 'play'
  2. Enter this into your php ide and save it as a .php file on your computer. Do the same on your computer, create a folder for playing around with so you don't affect your existing (good files).
  3. Let's call the file 'index.php'
  4. TIP: if you save and upload this file as 'index.php' - the browser will automatically default to it and display it when you refer to the folder name. eg. www.yourdomain.com/play/

    <!DOCTYPE html >
    <html>
    <head>
    <title> </title>
    </head>
    <body>
    <? print "Hello World"; ?>
    </body>
    </html>

    Now upload the file to your server using ftp
    Open up your browser and go to 'www.yourdomain.com/play/
    You should get your file showing with hello world up in the top left

    Once you've done that, you've proved your environment is working as it should.

    next