On Sat, 2004-02-14 at 02:31, Dave Carrera wrote:
> My question is what do or where do or why are the $var1 and or $var2
> included inside the brackets of a function.
> 
> What do they do ?
> 
> Why are they in there ?
> 
> And how are they used within an application ?

A good place to start reading about functions is in the php manual[1].

In short, functions are blocks of code that achieve a particular
purpose, or function.  Arguments[2] are used with functions to pass
information, or variables, to these blocks of code.  Generally the
arguments are used or manipulated by the function.  Functions may pass
back, or return[3], information as well.  Here are some sample
functions, function calls, and output for context.  Steps are separated
as much as possible for clarity:

// No arguments
function echoHelloWorld() {
        echo "Hello World\n";
}
echoHelloWorld(); // Output: Hello World

// Has arguments, uses data.
function printPlusOne($number) {
        $number = $number + 1;
        echo $number . "\n";
}
printPlusOne(2); // Output: 3

// Has arguments, manipulates and returns data.
function doubleNumber($number) {
        $number = $number * 2;
        return $number;
}
$value = doubleNumber(10);
echo $value . "\n"; // Output: 20

Good Luck,
Adam

[1] http://www.php.net/functions
[2] http://www.php.net/functions.arguments
[3] http://us2.php.net/functions.returning-values

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to