$thisVar != $thatVar ?: doThis(); or ($thisVar == $thatVar) && doThis(); or if ($thisVar == $thatVar) doThis();