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

Iffectation

An iffectation is both an assignation and a condition at the same time.

Whether an assignation should be used as a condition is debated. It makes the code less readable, as the assignation is hidden in the if condition.

It also saves some extra lines of code, when the condition applies to something that will immediately be used.

<?php

if ($trunk = trumpet()) { }

// same, without the iffectation
$trunk = trumpet();
if ($trunk) { }


?>

Documentation

See Also