PHP Tutorials

PHP Basics

This tutorial demonstrates the basic PHP commands every php'er should know...
Going to take the dive into PHP eh? Here are the basic commands you need to know.

PHP uses the echo command to to return a string to the browser.
echo "This will be returned to the browser";

In the example above we used echo to return a string to the browser.
One of the most important things in PHP are variables. In PHP you assign a variable with the $ sign.
$name = "Anwar";
echo "Hello there $name";

As you can see we used a variable in the example above, we assigned the value Anwar to the variable name, so the browser would now show Hello there Anwar.
PHP is also very suited for including files into web-pages:
include "menu.php";

In the above example we used the include command to include menu.php into our website. The browser will show all the contents of menu.php on our website.

The include feature really comes in handy when you have 30 pages with the same navigation links. You could just include menu.php on all of the web-pages and if you ever need to adjust a link in the navigation you would only have to adjust menu.php, instead of 30 separate web-pages.
This tutorial was by Pixelshade, brought to you by Robouk, please post any questions in the forum. Thank you.