It appears you have not yet registered with our community. To register please click here...


Function

This is a discussion on Function within the Coding Tutorials forums. Topic: Welcome to the functions tutorial, today you will be learning how to create you're own function. Code: <? function ...


Reply
 
Postbit Seperator LinkBack Thread Tools Postbit Seperator Search this Thread Postbit Seperator Display Modes
Old 12-10-2006, 01:39 PM   #1 (permalink)
 
Status: Junior Member
Join Date: Dec 2006
Posts: 25
Trader Rating: (0)
Retire at 21 is on a distinguished road
TD$: 0.00
Donate
Default 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.

Register @ Retire at 21 If you like this tutorial
Retire at 21 is offline   Reply With Quote
Table Bottom LeftTable BottomTable Bottom Right
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




Home | Site Map | Contact | Archive | Top

 

Copyright © 2007 - 2010 iTalkWebs Network

Search Engine Optimization by vBSEO 3.1.0