r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

41

u/aaptel Dec 02 '15

13

u/Scroph Dec 02 '15

Integer division with intdiv()

The new intdiv() function performs an integer division of its operands and returns it.

Looks like they finally added intdiv() !

3

u/[deleted] Dec 02 '15

Why? Performance?

6

u/merreborn Dec 02 '15

The / operator is exclusively floating point division, IIRC. This is in part a result of all the loose typing/automatic type juggling that happens. So for integer division, / was probably out of the question, leaving two options: add another operator exclusively for integer division, or a function.

→ More replies (4)
→ More replies (8)