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

Show parent comments

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.

-3

u/greyfade Dec 02 '15

This is because they don't understand the concept of overloading, and PHP doesn't have the concept of type casting.

→ More replies (3)