max() On String And Integer¶
In PHP 8, the rules of comparison between integers and strings have changed. Hence, max() may return a different value on PHP 7 and PHP 8.
PHP code¶
<?php
var_dump( max(['', 0]));
?>
Before¶
string(0)
After¶
int(0)
PHP version change¶
This behavior changed in 8.0