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

Increment On Boolean Is Deprecated

Incrementing or decrementing a boolean value had no effect. In PHP 8.3, it is now a deprecation warning, and a message.

PHP code

<?php

$a = true;
$a++;

$b = false;
--$b;
echo $a, $b;

?>

Before

1

After

PHP Warning:  Increment on type bool has no effect, this will change in the next major version of PHP 

Warning: Increment on type bool has no effect, this will change in the next major version of PHP 
PHP Warning:  Decrement on type bool has no effect, this will change in the next major version of PHP 

Warning: Decrement on type bool has no effect, this will change in the next major version of PHP 
1

PHP version change

This behavior was deprecated in 8.3.

This behavior changed in 9.0.

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat