PHP Warns When Finding Unconvertible Characters¶
PHP emits a deprecation when reaching a character that cannot be converted. For example, when converting from octal to decimal, a 8
, a 9
, or a letter cannot be converted to a number.
Until PHP 7.4, PHP would stop at that character, then return the converted part. Later, it also emits a warning.
PHP code¶
<?php
// 9 is not an octal number
echo octdec(342391);
?>
Before¶
14489
After¶
PHP Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /codes/octalNonConvertible.php on line 3
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /codes/octalNonConvertible.php on line 3
14489
PHP version change¶
This behavior changed in 7.4