Join Kevin Skoglund for an in-depth discussion in this video Type juggling and casting, part of PHP Essential Training.
- During the previous movies,…we've been looking at different types in PHPs.…So, strings, integers, floats,…those are all called types.…And we've seen a few times when PHP converted a value…from one type to another type for us.…For example, we were able to add a string to an integer,…and we saw that PHP converted a boolean true…to be the string one when it was output to our webpage.…This process is referred to as type juggling…when PHP does it on the fly for us.…We can also explicitly set a type ourselves,…for example converting a string one into the integer one,…and when we do it it's called type casting.…
And we can do type casting in two ways.…We can do it using a function.…We have the settype function for that purpose,…and it's just settype and then in parentheses two arguments,…the item that's being cast into another type, comma,…and then the second argument is the type…that we want to set it to.…So in this case, it's going to either…convert var to be an integer…or make sure that it already is an integer.…
- 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.