Site Navigation:

Home // Tutorials // PHP // Basics

Basic PHP Commands

1
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.

<?php
echo "This will be returned to the browser";
?>


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

<?php
$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".
3
PHP is also very suited for including files into web-pages:

<?php
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
spacer

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



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.