function contiguous($array) { $maxUpToIndex = $array[0]; $contiguous = $maxUpToIndex; for ($i = 1; $i < count($array); $i++) { $maxUpToIndex = greater($array[$i], $maxUpToIndex + $array[$i]); $contiguous = greater($contiguous, $maxUpToIndex); } return $contiguous; }
public function testGreater() { $expr = greater('id', 1); $this->assertExpr('`id` > "1"', $expr); }