Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: min(one, eight)?
(Example: nine)

The Note You're Voting On

yves
14 years ago
The behaviour of intval() is interesting when supplying a base, and you better check your intval base-based expressions, as it is counter-intuitive.
As the example shows
<?php
intval
('42', 8); // => 34
intval(42, 8); // => 42 !
?>
PHP considers the 42 as being already an integer, and doesn't apply any conversion. And supplying
<?php
intval
(49, 8); // => 49 !
?>
produces no error and no warning.

<< Back to user notes page

To Top