if ($i>1) { $a = function_that_may_fail(); $i = ($a) ? $i+1 : 1; } #### do { $a=function_that_may_fail(); $i= $a ? $i+1 : 1; } if ($i>1)