You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.3 KiB

This is a quick introduction to PHP, which will be expanded on (eventually).

What is PHP?

PHP Hyper-text Pre-Processor. Allows web developers to write dynamically generated pages quickly. With synergy!

PHP manual:

Basic PHP

  • cd to your ~/public_html folder on Redbrick.

cd ~/public_html

  • Create a file called hello.php using a text editor.

nano hello.php

  • Type this PHP code into the file

echo "Hello World!";

  • Save and exit (CTRL + O, CTRL + X)
  • Set correct permissions for the php file (this must be done for every .php file you want to use).

chmod 700 hello.php

  • Visit to view your script's output.
  • It should display “Hello World!” in plain text within your browser.

The include() function

Without understanding much about the details of PHP, you can save yourself a great deal of time with the use of the PHP include function. The include function takes a file name and simply inserts that file's contents into the script that calls the include function. (Ref:


About Us-
Contact Us


``\ Where you inserted “include(“menu.php”);” the contents of menu.php are included into index.php at that location. When you add or remove pages from your website, you only need to update one file, menu.php, in order to display a link on every page in your website that includes menu.php.


Like any decent programming language, PHP uses variables.

PHP variables can store any data you wish. They start with a $ sign and contain alphanumerical characters, but must always start with a letter.

$example1 = "example";
echo $example1;

This will output the text "example".

Variables as the name suggest can be altered after they're declared.

$example1 = "altered example";

$example1 now contains "altered example" and the previous contents are gone.