Site Navigation:

Home // Tutorials // PHP // Basics

Basic PHP Commands

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 "inlcude" 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.

Tutorial by Pixelshade:.
Pixel Shade link

This Tutorial was by Pixelshade, Please post any questions in the forum. Thank you.

Home Tutorials Free Stuff About Gallery Forum Links Contact

Copyright © Robouk 2001.

Dreamweaver®, Flash® and Photoshop® are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Hosted by Pixelcode - web design tutorials.