PHP Functions
PHP Functions
• To call the function, just write its name followed by parentheses ():
PHP Function Arguments:
Information can be passed to functions through arguments. An argument is just like a variable.
Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you
want, just separate them with a comma.
The following example has a function with one argument ($fname). When the familyName() function is called, we
also pass along a name (e.g. Jani), and the name is used inside the function, which outputs several different first
names, but an equal last name:
PHP Function Arguments:
• The following example has a function with two arguments ($fname and
$year):
PHP Default Argument Value