Tong-Pak-Fu

A place to relax and discuss.
 
HomePortalFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 PHP: Functions

View previous topic View next topic Go down 
AuthorMessage
BlUeAnGeL
New Otaku
New Otaku
avatar

Number of posts : 85
Registration date : 2007-04-21

PostSubject: PHP: Functions   Sat May 05, 2007 6:12 pm

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.
Back to top Go down
View user profile
 
PHP: Functions
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Tong-Pak-Fu :: Graphics And Web Discussion :: Photoshop/Webdesign :: Tutorial :: Web Design Tutorials-
Jump to: