Tong-Pak-Fu
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Tong-Pak-Fu

A place to relax and discuss.
 
HomePortalSearchLatest imagesRegisterLog in

 

 PHP: Functions

Go down 
AuthorMessage
BlUeAnGeL
New Otaku
New Otaku
BlUeAnGeL


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

PHP: Functions Empty
PostSubject: PHP: Functions   PHP: Functions Icon_minitimeSat 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
 
PHP: Functions
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: