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

Plus Plus Minus Minus

<?php

$d = 0;

echo $d + + - - 1;
?>

What does a separated list of plus and minus do to a literal? They will be merged independently in the literal. Here, two negations will make a positive, so we get a plus.

Don’t forget the space between the plus and minus, or it will be a post increment operator, and a different answer.

See Also

PHP Features

Last updated: 10 September 2026