$inNum) { $total += $key + 1; $inSum += $inNum; if ($total < $inSum) { $nonNum = $inNum -1; break; } } echo $nonNum."\n";