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: 14 July 2026