Join Kevin Skoglund for an in-depth discussion in this video Integer division with intdiv(), part of PHP 7 New Features.
- [Voiceover] In this movie, we're gonna learn…about PHP 7's new function: intdiv…and that's used for integer division.…Let me show you.…In PHP, we can divide one integer by another integer,…such as five divided by two…and if it doesn't divide evenly,…then PHP gives us back a floating-point number,…2.5 in this case.…What intdiv does is it always returns an integer to us,…whether it divides evenly or not.…Integers go in and an integer comes out.…
It's for when you're trying to figure out…the number of times that one number…can divide evenly into another number.…This can be useful, for example,…when you're creating columns or rows for your output.…You don't want the decimal portion.…You wanna know just how many times…can I divide this evenly.…Now, this is not the only way…that you can arrive at this answer.…And before PHP 7, you could do it a couple of ways.…You could use int in order to typecast that float…and make sure that it's an integer…or you could use floor.…Floor takes a floating point value and rounds it down.…
- Scalar type and return type declarations
- New operators in PHP 7
- Anonymous classes
- Arrays as constants
- Catchable exceptions and errors
- Integer division with intdiv()
- Deprecations and deletions
Skill Level Intermediate
1. Major Features
3. Deprecations and Deletions
- 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.