programming languages tutorials |
PHP Functions with Return values Posted: 02 Jan 2013 06:58 AM PST PHP Functions - Return values Functions can also be used to return values. Example
The output of the code above will be: 1 + 16 = 17 | ||
php functions with multiple parameters Posted: 02 Jan 2013 06:44 AM PST PHP Functions - Adding parameters The output of the code above will be: Our first function (writeMyName()) is a very simple function. It only writes a static string. To add more functionality to a function, we can add parameters. A parameter is just like a variable. You may have noticed the parentheses after the function name, like: writeMyName(). The parameters are specified inside the parentheses. Example 1 The following example will write different first names, but the same last name:
My name is Kai Jim Refsnes. My name is Hege Refsnes. My name is Stale Refsnes. Example 2 The following function has two parameters:
The output of the code above will be: My name is Kai Jim Refsnes. My name is Hege Refsnes! My name is Ståle Refsnes... |
You are subscribed to email updates from Programming Languages Tutorials To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
Post a Comment