In PHP, the division operator / returns an integer if the two operands are both integers and divide exactly, and a float in all other cases. (10 / 2) thus gives int(5), while (11 / 2) gives float(5.5). Then, in the next division step, 5 / 5 gives int(1), while 5.5 / 5.5 gives float(1).
PHP's language design is truly astounding.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
PHP
Prints
1 1 no
.In PHP, the division operator
/
returns an integer if the two operands are both integers and divide exactly, and a float in all other cases.(10 / 2)
thus givesint(5)
, while(11 / 2)
givesfloat(5.5)
. Then, in the next division step,5 / 5
givesint(1)
, while5.5 / 5.5
givesfloat(1)
.PHP's language design is truly astounding.