Function
Today you will be learning how to create you're own function.
Category: Coding
Views: 1497

Function Welcome to the functions tutorial, today you will be learning how to create you're own function.

Code:
function yourname($name){//Name you're function
$var = 'This is'.$name.''s function!';
return $var; //Return the string.
}//dont forget to close the function
?>

This is a function. In this example we have named it, gave it a parameter and returned the string.

Code:
function yourname(
This is where we name our function

Code:
return $var;
}
Here we return the string and end the function.

If you wanted to call the function you would use:

Code:
yourname('Gerard');
?>

So what this basicly does it takes the data from the function which is Gerard and places it in the variable which is $name and returns a string.

If you would like more help with this tutorial please register and visit the forum.

About Michael

Michael Dunlop Michael Dunlop personal statement

“But I am already older than 21”, I hear you cry. Don’t worry, despite the name, the information and advice is more geared towards retiring prior to having a fake hip installed.

Website Sponsors
Recommended Websites
They Buy, Build, Upgrade and Sell Websites.
 
Advertise Here
Feature Interviews
Graham went from $100 one day to ... Read more
Paul Bourque started affiliate marketing less than ... Read more
Interview with Yaro Starak of Entrepreneurs-Journey.com is ... Read more
Recommended Resources
 
 
 
 
 
Get Retire at 21's FREE Secrets
Find out how I'm going to Retire VERY Early Subscribe for my Free Secrets Privacy Guaranteed. 100% Spam free.