Non-canonical Cast¶
Non canonical cast operators (integer), (binary), (double), (boolean) are deprecated, since PHP 8.5.
PHP code¶
<?php
print (integer) 2;
print (double) 2;
print (boolean) 2;
print (binary) 2;
?>
Before¶
2212
After¶
PHP Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead
Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead
PHP Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead
Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead
PHP Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead
Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead
PHP Deprecated: Non-canonical cast (binary) is deprecated, use the (string) cast instead
Deprecated: Non-canonical cast (binary) is deprecated, use the (string) cast instead
2212
PHP version change¶
This behavior changed in 8.5