Okay, so you have a bunch of php code that does the SAME THING, and you dont want to keep copying and pasteing it.. So.. you make a function ;D
Heres an example redirect function..
- Code:
-
function redirect ($url) {
header("Location: " . $url);
}
redirect is the function name, and ($url) is where you set the vars that are passed to it..
So.. you have this function.. but how do you call it? Easy!
- Code:
-
redirect("http://google.com");
Alright so lets say you want a function to call someone something... it would go like this..
- Code:
-
function callname ($who,$what) {
echo $who . " is a " . $what;
}
So now you would call it like this..
callname("Blueangel","hawt chick.");
And you would get..
- Code:
-
Blueangel is a hawt chick.