php Tutorials
Creating An RSS Feed With PHP And MySQL
Retrieving XML With Curl and SimpleXML
Using curl to Query Remote Servers
MySQL Basics
PHP mySQL Voting Booth
File Download Security
PHP Fundamentals

PHP Fundamentals

Includes and functions

Includes and functions are great for storing routines that are used multiple times. Functions allow you to call routines that are used repeatedly with one line. Includes are excellent for loading variable sets or loading lists of functions that are used on multiple pages.


include ("config.php");

Includes are self explanatory include ("{filename to include}");


function getmonth($month) {
    $montharray=array("01" => "January",
    return ($returnmonth);

Variables in functions are exclusive to that function meaning setting a variable doesn't mean its set out of the function. Passing variables to a function is done with the function statement, put the variable in parentheses after the function name. Use the return statement to pass a variable back out of the function.


This runs the function getmonth and sets $month to February

Loops <<  1 2 3 4 5 6
New Content