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.…
Author
Released
6/27/2017- 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
Duration
Views
Related Courses
-
MVC Frameworks for Building PHP Web Applications
with Drew Falkman2h 57m Intermediate
-
Introduction
-
Introduction54s
-
-
1. PHP Overview
-
What is PHP?3m 46s
-
Text editor for Mac5m 1s
-
Text editor for Windows5m 51s
-
-
2. First Steps
-
Embed PHP code on a page6m 43s
-
Output dynamic text5m 55s
-
The operational trail2m 27s
-
Insert code comments4m 7s
-
-
3. Explore Data Types
-
Variables7m 50s
-
Strings4m 38s
-
String functions8m 53s
-
Numbers, part 1: Integers6m 27s
-
Arrays10m
-
Associative arrays6m 37s
-
Array functions6m 33s
-
Booleans3m 50s
-
NULL and empty5m 15s
-
Type juggling and casting8m 27s
-
Constants4m 43s
-
-
4. Control Structures: Logical Expressions
-
Else and elseif statements4m 16s
-
Logical operators7m 30s
-
Switch statements9m 51s
-
5. Control Structures: Loops
-
While loops8m 41s
-
For loops5m 59s
-
Foreach loops8m 16s
-
Continue8m 28s
-
Break4m 8s
-
Understanding array pointers6m 43s
-
-
6. User-Defined Functions
-
Define functions8m 25s
-
Function arguments5m 32s
-
Multiple return values4m 53s
-
-
7. Debug
-
Warnings and errors3m 47s
-
Common problems8m 36s
-
Debug and troubleshoot7m 55s
-
-
Conclusion
-
Next steps59s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Multiple return values