Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 was deprecated in 8.5.

This behavior changed in 8.5.

Error Messages

© 2023-2026, Damien Seguy - Exakat