Join Kevin Skoglund for an in-depth discussion in this video Multiple return values, part of PHP Essential Training.
- [Instructor] In the last movie we learned…how to return values from a function by using return.…In this movie, we'll learn how to return…multiple values from function.…Well, sort of.…You see, a function can only return a single value.…That's a hard and fast rule about functions,…that it returns only a single value.…So what if we need to return more than one value?…Well first let's create an example,…so we can look at the problem more closely.…I'm going to open up basic.html,…and I'll do a Save As on that.…And I'm going to call this functions_multiplereturns.php.…
We'll give it the same name here,…"Functions: Multiple Returns".…Alright let's start with a new function,…and this function I've called add_subt,…short for subtract.…So it's going to add and subtract two values,…value 1 and value 2.…We're going to add them together,…and then we're going to subtract them.…So we know how to use return, and how to return add.…But how can we also return subt too?…Let's just try this real quick and see.…Let's go ahead and have result.…
- What is PHP?
- Embedding PHP code on a page
- Inserting code comments
- Variables, strings, arrays, and Booleans
- If, else, and elseif statements
- While and for loops
- User-defined functions
- Function arguments and return values
- Debugging and troubleshooting
Skill Level Beginner
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. PHP Overview
2. First Steps
3. Explore Data Types
4. Control Structures: Logical Expressions
5. Control Structures: Loops
6. User-Defined Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.